DSA Bloom logo
DSA BLOOM / Q&A

Ask. Learn.
Crack DSA.

A focused DSA question bank for building strong fundamentals and preparing for technical interviews. Review concise answers, compare core concepts, and sharpen your problem-solving vocabulary.

50 Core Questions30 Interview QuestionsQuick AnswersInterview Ready
Explore Questions

DSA Questions & Answers

50 essential questions covering data structures, algorithms, trees, graphs, searching, sorting, and hashing.

CORE 01

1. What is a Data Structure?

Answer

A Data Structure is a way to store and organize data so that it can be accessed and modified efficiently.

CORE 02

2. What is an Algorithm?

Answer

An Algorithm is a step-by-step procedure or formula for solving a problem.

CORE 03

3. What is a Stack?

Answer

A Stack is a linear data structure which follows LIFO (Last In First Out) principle.

CORE 04

4. What is a Queue?

Answer

A Queue is a linear data structure which follows FIFO (First In First Out) principle.

CORE 05

5. What is a Linked List?

Answer

A Linked List is a linear data structure where elements are stored in nodes connected via pointers.

CORE 06

6. What is an Array?

Answer

An Array is a collection of elements stored at contiguous memory locations.

CORE 07

7. What is a Binary Tree?

Answer

A Binary Tree is a tree data structure in which each node has at most two children.

CORE 08

8. What is a Binary Search Tree (BST)?

Answer

A BST is a binary tree where the left child contains values less than the parent node and the right child contains values greater than the parent node.

CORE 09

9. What is a Graph?

Answer

A Graph is a non-linear data structure consisting of nodes (vertices) connected by edges.

CORE 10

10. What is Depth First Search (DFS)?

Answer

DFS is a graph traversal algorithm that explores as far as possible along each branch before backtracking.

CORE 11

11. What is Breadth First Search (BFS)?

Answer

BFS is a graph traversal algorithm that explores all neighbors of a node before moving to the next level.

CORE 12

12. What is a Heap?

Answer

A Heap is a special tree-based data structure that satisfies the heap property: max-heap or min-heap.

CORE 13

13. What is a Priority Queue?

Answer

A Priority Queue is an abstract data type where each element has a priority and elements with higher priority are served first.

CORE 14

14. What is a Hash Table?

Answer

A Hash Table is a data structure that maps keys to values using a hash function for fast access.

CORE 15

15. What is a Circular Queue?

Answer

A Circular Queue is a linear data structure in which the last position is connected back to the first position to make a circle.

CORE 16

16. What is Recursion?

Answer

Recursion is a technique where a function calls itself to solve smaller instances of a problem.

CORE 17

17. What is the difference between linear and non-linear data structures?

Answer

Linear data structures store elements sequentially (e.g., array, stack, queue). Non-linear structures do not follow a sequence (e.g., tree, graph).

CORE 18

18. What is a Doubly Linked List?

Answer

A Doubly Linked List is a linked list where each node points to both its previous and next node.

CORE 19

19. What is a Singly Linked List?

Answer

A Singly Linked List is a linked list where each node points only to the next node.

CORE 20

20. What is a Dynamic Array?

Answer

A Dynamic Array is an array that can grow or shrink in size during program execution.

CORE 21

21. What is Stack Overflow?

Answer

Stack Overflow occurs when there is no more space in the stack for new elements, often due to infinite recursion.

CORE 22

22. What is a Deque?

Answer

A Deque (Double Ended Queue) allows insertion and deletion at both ends.

CORE 23

23. What is Linear Search?

Answer

Linear Search is a search algorithm that checks each element of a list sequentially until the desired element is found.

CORE 24

24. What is Binary Search?

Answer

Binary Search is a search algorithm that works on sorted arrays by repeatedly dividing the search interval in half.

CORE 25

25. What is Merge Sort?

Answer

Merge Sort is a divide-and-conquer sorting algorithm that divides the array into halves, sorts them, and merges them back.

CORE 26

26. What is Quick Sort?

Answer

Quick Sort is a divide-and-conquer sorting algorithm that selects a pivot and partitions the array around the pivot.

CORE 27

27. What is Bubble Sort?

Answer

Bubble Sort is a simple sorting algorithm that repeatedly swaps adjacent elements if they are in the wrong order.

CORE 28

28. What is Selection Sort?

Answer

Selection Sort repeatedly selects the minimum element from the unsorted part and moves it to the sorted part.

CORE 29

29. What is Insertion Sort?

Answer

Insertion Sort builds the final sorted array one element at a time by inserting elements at the correct position.

CORE 30

30. What is a Tree Traversal?

Answer

Tree Traversal is the process of visiting all the nodes in a tree in a specific order (e.g., inorder, preorder, postorder).

CORE 31

31. What is a Graph Traversal?

Answer

Graph Traversal is visiting all nodes in a graph systematically using algorithms like BFS or DFS.

CORE 32

32. What is Adjacency Matrix?

Answer

An Adjacency Matrix is a 2D array used to represent a graph where rows and columns represent nodes.

CORE 33

33. What is Adjacency List?

Answer

An Adjacency List represents a graph as an array of lists where each list contains neighbors of a node.

CORE 34

34. What is a Sparse Graph?

Answer

A Sparse Graph has relatively few edges compared to the maximum possible edges.

CORE 35

35. What is a Dense Graph?

Answer

A Dense Graph has many edges, close to the maximum possible edges.

CORE 36

36. What is a Directed Graph?

Answer

A Directed Graph has edges with direction, indicating the connection from one node to another.

CORE 37

37. What is an Undirected Graph?

Answer

An Undirected Graph has edges without direction, meaning connections are bidirectional.

CORE 38

38. What is a Cycle in a Graph?

Answer

A Cycle is a path in a graph that starts and ends at the same vertex.

CORE 39

39. What is a Connected Graph?

Answer

A Connected Graph is a graph where there is a path between every pair of vertices.

CORE 40

40. What is a Disconnected Graph?

Answer

A Disconnected Graph has at least two vertices that are not connected by a path.

CORE 41

41. What is a Weighted Graph?

Answer

A Weighted Graph is a graph where each edge has a numerical weight or cost.

CORE 42

42. What is an Unweighted Graph?

Answer

An Unweighted Graph is a graph where all edges are considered equal (no weights).

CORE 43

43. What is a Minimum Spanning Tree (MST)?

Answer

An MST of a graph is a subset of edges that connects all vertices with minimum total edge weight.

CORE 44

44. What is Dijkstra’s Algorithm?

Answer

Dijkstra’s Algorithm finds the shortest path from a source vertex to all other vertices in a weighted graph.

CORE 45

45. What is Bellman-Ford Algorithm?

Answer

Bellman-Ford Algorithm finds the shortest paths from a single source vertex to all other vertices, even with negative weights.

CORE 46

46. What is Topological Sort?

Answer

Topological Sort is a linear ordering of vertices in a directed acyclic graph (DAG) such that for every edge u → v, u comes before v.

CORE 47

47. What is a Hash Function?

Answer

A Hash Function maps input data to a fixed-size value, often used in hash tables.

CORE 48

48. What is Collision in Hashing?

Answer

A Collision occurs when two different keys produce the same hash value.

CORE 49

49. What is Chaining in Hashing?

Answer

Chaining is a technique to handle collisions by storing multiple elements in a linked list at the same hash index.

CORE 50

50. What is Open Addressing in Hashing?

Answer

Open Addressing resolves collisions by finding another empty slot in the hash table using probing techniques.

Top 30 DSA Interview Asked Questions & Answers

30 interview questions with concise answers from the supplied DSA content.

INTERVIEW 01

1. What is the difference between Stack and Queue?

Answer

Stack follows LIFO (Last In First Out) whereas Queue follows FIFO (First In First Out).

INTERVIEW 02

2. What is the difference between Array and Linked List?

Answer

Arrays use contiguous memory and allow fast index access. Linked Lists use pointers, allow dynamic memory allocation, but slower access.

INTERVIEW 03

3. What is a Binary Search Tree (BST)?

Answer

A BST is a binary tree where the left child is less than the parent and the right child is greater. It allows efficient searching, insertion, and deletion.

INTERVIEW 04

4. What is the difference between BFS and DFS?

Answer

BFS explores neighbors level by level using a queue; DFS explores as deep as possible using a stack or recursion.

INTERVIEW 05

5. What is a Heap?

Answer

A Heap is a special tree-based structure that satisfies the heap property: max-heap (parent ≥ children) or min-heap (parent ≤ children).

INTERVIEW 06

6. What is a Hash Table and how does it work?

Answer

A Hash Table maps keys to values using a hash function for fast insertion, deletion, and lookup.

INTERVIEW 07

7. What is the difference between Linear and Binary Search?

Answer

Linear search checks elements sequentially (O(n)). Binary search works on sorted arrays, dividing the search space (O(log n)).

INTERVIEW 08

8. What is Recursion and its use?

Answer

Recursion is a function calling itself to solve smaller instances of a problem. It is used in tree traversal, divide & conquer algorithms, and backtracking.

INTERVIEW 09

9. What is the difference between Singly and Doubly Linked List?

Answer

Singly Linked List nodes point only to the next node. Doubly Linked List nodes point to both previous and next nodes.

INTERVIEW 10

10. What is a Circular Queue?

Answer

A Circular Queue connects the last element back to the first, allowing efficient use of memory for insertion and deletion.

INTERVIEW 11

11. What is a Graph?

Answer

A Graph is a collection of vertices connected by edges, which can be directed or undirected, weighted or unweighted.

INTERVIEW 12

12. What is the difference between a Tree and a Graph?

Answer

A Tree is an acyclic connected graph with hierarchical structure. A Graph can have cycles and arbitrary connections.

INTERVIEW 13

13. What is Topological Sorting?

Answer

Topological sorting is a linear ordering of vertices in a DAG such that for every directed edge u→v, u comes before v.

INTERVIEW 14

14. What is a Minimum Spanning Tree (MST)?

Answer

MST is a subset of edges in a weighted graph connecting all vertices with the minimum total weight.

INTERVIEW 15

15. What is Dijkstra’s Algorithm?

Answer

Dijkstra’s algorithm finds the shortest path from a source vertex to all other vertices in a weighted graph with non-negative weights.

INTERVIEW 16

16. What is the difference between DFS and Backtracking?

Answer

DFS is a traversal strategy. Backtracking uses DFS along with undoing choices to solve problems like puzzles, N-Queens, and combinatorial search.

INTERVIEW 17

17. What is a Priority Queue?

Answer

A Priority Queue is a queue where elements with higher priority are dequeued before elements with lower priority.

INTERVIEW 18

18. What is the difference between Merge Sort and Quick Sort?

Answer

Merge Sort divides and merges arrays, stable and O(n log n). Quick Sort uses a pivot to partition arrays, generally faster but unstable.

INTERVIEW 19

19. What is a Cycle in a Graph?

Answer

A Cycle is a path that starts and ends at the same vertex in a graph.

INTERVIEW 20

20. What is a Sparse vs Dense Graph?

Answer

Sparse Graph has few edges relative to vertices; Dense Graph has edges close to the maximum possible.

INTERVIEW 21

21. What is an Adjacency Matrix?

Answer

An Adjacency Matrix is a 2D array representation of a graph, where cell (i,j) indicates the edge between vertices i and j.

INTERVIEW 22

22. What is an Adjacency List?

Answer

An Adjacency List represents a graph as an array of lists, where each list contains neighbors of a vertex.

INTERVIEW 23

23. What is a Hash Collision?

Answer

A Hash Collision occurs when two different keys hash to the same index in a hash table.

INTERVIEW 24

24. What is Chaining in Hashing?

Answer

Chaining handles collisions by storing multiple elements at the same hash index using a linked list.

INTERVIEW 25

25. What is Open Addressing in Hashing?

Answer

Open Addressing resolves collisions by finding the next available slot in the hash table using probing.

INTERVIEW 26

26. What is a Balanced Tree?

Answer

A Balanced Tree maintains minimal height to optimize search, insertion, and deletion operations.

INTERVIEW 27

27. What is the difference between BFS and Level Order Traversal?

Answer

BFS is a graph traversal algorithm. Level Order Traversal is BFS applied specifically to a tree structure.

INTERVIEW 28

28. What is the difference between Stack and Recursion?

Answer

Recursion internally uses a call stack to track function calls. Stack is an explicit data structure for LIFO operations.

INTERVIEW 29

29. What is a Dynamic Programming (DP)?

Answer

DP is an optimization technique to solve problems by storing results of overlapping subproblems to avoid recomputation.

INTERVIEW 30

30. What is Greedy Algorithm?

Answer

A Greedy Algorithm makes the locally optimal choice at each step, hoping to find the global optimum.