🌳

Data Structures & Algorithms MCQ

Test your Data Structures & Algorithms knowledge with 100 multiple choice questions covering fundamentals to advanced concepts, with instant feedback and explanations.

100 Questions 40 Beginner 40 Intermediate 20 Advanced
1

What is the time complexity of accessing an element in an array by index?

2

Which data structure operates on a Last-In, First-Out (LIFO) principle?

3

What is the time complexity of inserting an element at the beginning of a singly linked list?

4

Which data structure uses FIFO (First-In, First-Out) ordering?

5

What is a binary search tree (BST)?

6

What is the worst-case time complexity of binary search?

7

What does a hash table use to map keys to values?

8

What is a graph?

9

Which traversal visits root, left subtree, right subtree in that order?

10

What is the space complexity of a recursive function that calls itself n times?

11

What is a min-heap?

12

What is the time complexity of bubble sort in the worst case?

13

What does DFS stand for in graph algorithms?

14

What is a doubly linked list?

15

Which sorting algorithm has the best average-case time complexity?

16

What is an adjacency matrix?

17

What is the height of a balanced binary tree with n nodes?

18

Which data structure is best for implementing a priority queue?

19

What is an inorder traversal of a BST guaranteed to produce?

20

What is the average-case time complexity of searching in a hash table?

21

What is a circular queue?

22

What is the difference between a tree and a graph?

23

What operation does a stack use to add an element?

24

What is the worst-case time complexity of quicksort?

25

What is a deque (double-ended queue)?

26

What is a spanning tree of a graph?

27

What is the time complexity of merge sort?

28

What is a trie (prefix tree)?

29

What is the purpose of BFS (Breadth-First Search)?

30

What is a self-balancing BST?

31

What does Big O notation describe?

32

What is a hash collision?

33

What is insertion sort best suited for?

34

What is the in-degree of a node in a directed graph?

35

What does a stack overflow error indicate in recursive algorithms?

36

What is the primary advantage of a linked list over an array?

37

What is postorder traversal?

38

What is amortized time complexity?

39

What is the difference between a complete binary tree and a full binary tree?

40

What is a sentinel node in a linked list?

1

What is the time complexity of Dijkstra's algorithm using a binary heap?

2

What distinguishes an AVL tree from a standard BST?

3

What is dynamic programming?

4

What is topological sorting?

5

What is the Floyd-Warshall algorithm used for?

6

What is the difference between Prim's and Kruskal's algorithms?

7

What is a Red-Black tree?

8

What is the Bellman-Ford algorithm's advantage over Dijkstra's?

9

What is the Union-Find (Disjoint Set Union) data structure used for?

10

What is the Knuth-Morris-Pratt (KMP) algorithm used for?

11

What is memoization?

12

What is the difference between a B-tree and a B+ tree?

13

What is a segment tree used for?

14

What is the time complexity of heapify (build-heap) for n elements?

15

What is the LRU cache and which data structures implement it efficiently?

16

What does Kadane's algorithm solve?

17

What is a skip list?

18

What is the two-pointer technique?

19

What is a Fenwick tree (Binary Indexed Tree)?

20

What is the sliding window technique?

21

What is a cycle in a directed graph, and how is it detected?

22

What is the master theorem used for?

23

What is the longest common subsequence (LCS) problem?

24

What is the 0/1 knapsack problem?

25

What is the time complexity of Heap Sort?

26

What is a graph's strongly connected component (SCC)?

27

What is the difference between greedy algorithms and dynamic programming?

28

What is radix sort and when is it faster than comparison-based sorts?

29

What problem does the A* algorithm solve?

30

What is a monotonic stack?

31

Why is a hash map preferred over an array for the "two sum" problem when aiming for O(n) time?

32

In a min-heap represented as an array (0-indexed), how do you find the parent of the node at index i?

33

What is the key idea behind the "fast and slow pointer" (Floyd's cycle detection) technique on a linked list?

34

When choosing between an array-based and a linked-list-based implementation of a stack, what is a key practical tradeoff?

35

Why does counting sort run in linear time, and what limits its applicability?

36

What is the main advantage of using a hash set to detect duplicates in a collection compared to sorting first?

37

In graph traversal, what is the practical effect of using a stack (DFS) versus a queue (BFS) when searching for a target node?

38

Why might quicksort be implemented with random pivot selection or median-of-three pivot selection in practice?

39

When converting a recursive algorithm into an iterative one using an explicit stack, what is being manually managed?

40

Why is binary search not directly applicable to a singly linked list even though the list is sorted?