All 93 questions

  1. How do BFS and DFS differ, and when would you choose BFS?

    Asked in 5 of 374 interviews · last asked Oct 7 · Concept · Junior

    Show answer

    BFS explores nodes level by level using a queue. DFS follows one path as far as possible before backtracking, using a stack or recursion. Choose BFS to find a shortest path in an unweighted graph, find the nearest matching node, or process nodes level by level.

    • BFS finds paths with the fewest edges; DFS does not guarantee this.
    • Both take O(V + E) time with adjacency lists, where V counts vertices and E counts edges.
    • Track visited nodes in graphs to avoid revisiting nodes and looping through cycles.
    • BFS can hold many nodes on wide levels; recursive DFS risks stack overflow on deep paths.

    What the interviewer checks: The interviewer checks whether you understand traversal order, data structures, and why BFS suits unweighted shortest paths.

    Other ways it was asked
    • “What is the difference between BFS and DFS?”
    • “How are DFS and BFS different?”
    • “What is the difference between depth-first search (DFS) and breadth-first search (BFS)?”
  2. What is Dijkstra's algorithm, and when is it used?

    Asked in 3 of 374 interviews · last asked Oct 9 · Concept · Junior

    Other ways it was asked
    • “Can you explain the Dijkstra algorithm?”
    • “What is the Dijkstra algorithm?”
  3. Explain the A* algorithm for calculating the shortest path.

    Asked in 2 of 374 interviews · last asked Oct 9 · Concept · Junior

    Other ways it was asked
    • “Can you explain the A* algorithm?”
  4. Which data structure is commonly used for indexing in a database management system?

    Asked in 2 of 374 interviews · last asked Aug 27 · Concept · Junior

    Other ways it was asked
    • “What data structures are commonly used to implement database indexes?”
  5. What is a binary search tree?

    Asked in 2 of 374 interviews · last asked Sep 30 · Concept · Junior

  6. What algorithmic approach would you use to find the longest consecutive sequence along a root-to-leaf path in a tree?

    Asked once · last asked Sep 15 · Write code · Mid-level

    Other ways it was asked
    • “What is the time complexity of an algorithm for finding the longest consecutive sequence along a root-to-leaf path in a tree?”
    • “How would you solve the same problem when given a tree, finding the longest consecutive sequence along any path from the root to a leaf?”
    • “How would you solve the problem of finding the longest consecutive sequence along a root-to-leaf path in a tree?”
  7. How would you implement hierarchical folder traversal in Power Apps or Power Automate?

    Asked once · last asked Jun 9 · Tooling · Mid-level

    Other ways it was asked
    • “How would you implement hierarchical folder traversal in Power Automate?”
  8. Given an array of integers, how would you convert it into a min heap?

    Asked once · last asked Jul 27 · Concept · Junior

    Other ways it was asked
    • “Please explain the process of converting an array of integers into a min heap.”
  9. In the binary-tree maximum path sum problem, what counts as a path, and how should the solution handle a tree whose node values are all negative?

    Asked once · last asked Sep 10 · Concept · Mid-level

    Other ways it was asked
    • “How should a binary-tree maximum path sum solution handle an all-negative tree or an empty tree?”
    • “How should a binary-tree maximum path sum algorithm handle a negative contribution from a child node?”
  10. What is the difference between a graph and a tree?

    Asked once · last asked Jan 27 · Concept · Junior

  11. When modeling a problem as a graph, what should the vertices and edges represent?

    Asked once · last asked Jan 27 · Concept · Mid-level

  12. What is a B-tree index, and how does it work?

    Asked once · last asked Feb 23 · Concept · Mid-level

  13. Implement logic to traverse the hierarchical folder structure, check each folder for files, and print the name of every folder that contains files.

    Asked once · last asked Jun 9 · Write code · Mid-level

  14. How would you traverse a hierarchical folder structure, and would you use a for loop?

    Asked once · last asked Jun 9 · Write code · Mid-level

  15. How would you traverse subfolders and check whether they contain files?

    Asked once · last asked Jun 9 · Write code · Mid-level

  16. How would you process a hierarchical folder structure represented as JSON to identify folders that contain files?

    Asked once · last asked Jun 9 · Write code · Mid-level

  17. What is the time complexity of search, insertion, and deletion in a balanced binary search tree such as a red-black tree?

    Asked once · last asked Jul 16 · Concept · Junior

  18. Which hashes in a Merkle tree change when a transaction is modified?

    Asked once · last asked Jul 8 · Concept · Junior

  19. Given the preorder traversal of a binary search tree and an existing node class, how would you write a function to reconstruct and return the tree?

    Asked once · last asked Nov 19 · Write code · Junior

  20. How would you solve the Clone Graph problem?

    Asked once · last asked Jul 25 · Write code · Mid-level

  21. If you have a binary search tree, what would be the maximal depth of the tree containing 10 nodes?

    Asked once · last asked Jul 27 · Concept · Junior

  22. How are max heaps and min heaps used in practical applications?

    Asked once · last asked Jul 27 · Concept · Junior

    Other ways it was asked
    • “Can you describe a practical use case for a min heap?”
  23. Can you explain what heapifying down means and how it works in maintaining the min heap property?

    Asked once · last asked Jul 27 · Concept · Mid-level

  24. How do you perform a level order traversal of a binary tree?

    Asked once · last asked Jul 27 · Concept · Junior

  25. How would you handle duplicates if you were implementing a binary search tree?

    Asked once · last asked Jul 27 · Scenario · Mid-level

  26. Can you implement a function to find the kth largest element in a max heap? Please explain your steps.

    Asked once · last asked Jul 27 · Write code · Mid-level

  27. What should a function that finds the kth largest element in a max heap do if the heap is empty?

    Asked once · last asked Jul 27 · Scenario · Junior

  28. What is the time complexity of inserting an element in a max heap?

    Asked once · last asked Jul 29 · Concept · Junior

  29. What key benefits and trade-offs would lead you to choose HNSW indexing over other indexing options?

    Asked once · last asked Jul 30 · Concept · Mid-level

    Other ways it was asked
    • “When selecting HNSW indexing over other options, what key benefits or considerations made it the right choice for your project?”
  30. Can you create a tree representation in C++ with shapes stored in the nodes, then implement a post-order traversal, making production-style design choices and doing a little testing?

    Asked once · last asked Aug 12 · Write code · Mid-level

  31. In a directed graph, how do you detect a cycle efficiently, and how does your approach differ between using a DFS recursion stack and Kahn's algorithm?

    Asked once · last asked Aug 13 · Concept · Mid-level

  32. How does the order of a B-tree determine the maximum number of children per node?

    Asked once · last asked Aug 27 · Concept · Junior

  33. How would you store a graph in memory?

    Asked once · last asked Sep 4 · Concept · Junior

  34. How do adjacency lists and adjacency matrices compare for representing graphs?

    Asked once · last asked Sep 4 · Concept · Junior

  35. What is a strongly connected component in a directed graph?

    Asked once · last asked Sep 4 · Concept · Junior

  36. Which shortest-path algorithm can handle negative edge weights?

    Asked once · last asked Sep 4 · Concept · Junior

  37. Is Bellman-Ford a dynamic programming approach or a greedy approach?

    Asked once · last asked Sep 4 · Concept · Junior

  38. What is Kosaraju's algorithm, and how does it find strongly connected components?

    Asked once · last asked Sep 4 · Concept · Junior

  39. You have a BST with two nodes swapped by mistake. How would you recover it?

    Asked once · last asked Sep 4 · Write code · Junior

  40. What are the time and space complexities of a breadth-first search (BFS) approach?

    Asked once · last asked Sep 4 · Concept · Mid-level

  41. What is a B+ tree, and how does it work?

    Asked once · last asked Sep 6 · Concept · Mid-level

    Other ways it was asked
    • “Explain the B+ tree algorithm.”
  42. How would you find all nodes at distance k from a target node in a binary tree?

    Asked once · last asked Sep 10 · Write code · Mid-level

    Other ways it was asked
    • “How would you handle duplicate values in a binary tree when finding nodes at distance k from a target?”
  43. How would you use a parent map and queue to find all nodes at distance k from a target node in a binary tree?

    Asked once · last asked Sep 10 · Scenario · Mid-level

    Other ways it was asked
    • “How do you plan to use the parent map and queue for finding nodes at distance k?”
  44. How would a search for nodes at distance k from a target in a binary tree behave if the target is a leaf node and k is two?

    Asked once · last asked Sep 10 · Scenario · Mid-level

    Other ways it was asked
    • “How would a distance-k search behave if the target is a leaf node and k is two?”
  45. Why does a breadth-first search for nodes at distance k in a binary tree use a visited set?

    Asked once · last asked Sep 10 · Concept · Mid-level

  46. If k exceeds the tree's height, what should a distance-k search return, and why?

    Asked once · last asked Sep 10 · Scenario · Mid-level

  47. How would a depth-first search method for finding nodes at distance k in a binary tree differ from a breadth-first search method?

    Asked once · last asked Sep 10 · Concept · Mid-level

  48. How could you reduce the extra memory used by a breadth-first or depth-first approach for finding nodes at distance k in a binary tree?

    Asked once · last asked Sep 10 · Scenario · Senior

  49. How would you process a very large binary tree that cannot fit entirely in memory?

    Asked once · last asked Sep 10 · Scenario · Senior

  50. How would you prevent integer overflow when calculating path sums in a language with bounded integer types?

    Asked once · last asked Sep 10 · Scenario · Mid-level

  51. How should a binary-tree maximum path sum algorithm update the best sum when the maximum path does not pass through the root?

    Asked once · last asked Sep 10 · Concept · Mid-level

  52. Count islands in a grid using DFS, including diagonal connections, and explain the traversal and base cases.

    Asked once · last asked Sep 10 · Write code · Mid-level

    Other ways it was asked
    • “What approach would you take to count the islands in a 2D grid, considering horizontal, vertical, and diagonal connections?”
    • “In a DFS solution for counting islands in a 2D grid, what is the base case, and how would you structure the grid traversal?”
  53. What invariant justifies that a node's distance is final when it is popped from the priority queue in Dijkstra's algorithm?

    Asked once · last asked Sep 15 · Concept · Mid-level

    Other ways it was asked
    • “In Dijkstra's algorithm, why is a node's distance final when it is popped from the priority queue?”
  54. What edge case or bug can cause an incorrect result in a first implementation of Dijkstra's algorithm, and how would you detect and fix it?

    Asked once · last asked Sep 15 · Scenario · Mid-level

  55. How would you approach finding the longest sequence of consecutive numbers in a graph that may contain cycles?

    Asked once · last asked Sep 15 · Write code · Senior

  56. How would you model an AGV traffic-control map using waypoints and edges?

    Asked once · last asked Sep 25 · Design · Senior

  57. When scheduling robot routes, how could you use cycle detection in a graph to identify potential deadlocks?

    Asked once · last asked Sep 25 · Concept · Senior

  58. Using zero-based indexing, what are the exact formulas for parent, left child, and right child in an array-backed binary heap?

    Asked once · last asked Oct 4 · Concept · Junior

  59. How do you create a min-heap of pairs using a priority queue?

    Asked once · last asked Oct 15 · Concept · Junior

  60. What is a Merkle proof?

    Asked once · last asked Jul 8 · Concept · Junior

    Other ways it was asked
    • “What does a Merkle proof consist of, and who receives it?”
  61. What is the difference between preorder and postorder traversal?

    Asked once · last asked Sep 3 · Concept · Junior

  62. What is a graph?

    Asked once · last asked Jan 27 · Concept · Junior

  63. What connects one vertex to another in a graph?

    Asked once · last asked Jan 27 · Concept · Junior

  64. Do graphs have a root, or is a root a concept specific to trees?

    Asked once · last asked Jan 27 · Concept · Junior

  65. What are Merkle trees used for?

    Asked once · last asked Jul 8 · Concept · Junior

  66. Can you explain what the BFS algorithm is and when it is used?

    Asked once · last asked Jul 13 · Concept · Junior

  67. What are in-order, pre-order, and post-order tree traversals?

    Asked once · last asked Nov 19 · Concept · Junior

  68. In a task graph, how would you define a child task?

    Asked once · last asked Jul 22 · Concept · Mid-level

  69. Describe the differences between a max heap and a min heap.

    Asked once · last asked Jul 27 · Concept · Junior

  70. Explain why level order traversal is useful.

    Asked once · last asked Jul 27 · Concept · Junior

  71. Give an example application of level order traversal.

    Asked once · last asked Jul 27 · Concept · Junior

  72. What happens if you insert a duplicate value into a binary search tree?

    Asked once · last asked Jul 27 · Concept · Junior

  73. What is a complete binary tree?

    Asked once · last asked Jul 29 · Concept · Junior

  74. Can you implement a graph algorithm?

    Asked once · last asked Aug 17 · Write code · Mid-level

  75. Are you aware of the heap data structure? How does it work?

    Asked once · last asked Aug 20 · Concept · Junior

  76. What are the types of heap data structures?

    Asked once · last asked Aug 20 · Concept · Junior

  77. What is the maximum number of children a node in a binary tree can have?

    Asked once · last asked Aug 27 · Concept · Junior

    Other ways it was asked
    • “How many children can a binary tree have?”
  78. Tell me about a binary tree.

    Asked once · last asked Sep 1 · Concept · Junior

  79. What is a graph in data structures?

    Asked once · last asked Sep 4 · Concept · Junior

  80. What is a tree in data structures?

    Asked once · last asked Sep 4 · Concept · Junior

  81. What is a dense graph?

    Asked once · last asked Sep 4 · Concept · Junior

  82. Describe a graph problem from a coding platform and explain how you would solve it.

    Asked once · last asked Sep 4 · Write code · Junior

    Other ways it was asked
    • “Can you describe a graph problem you solved on a coding platform and explain your approach?”
  83. What does mutual reachability mean for vertices in a strongly connected component?

    Asked once · last asked Sep 4 · Concept · Junior

  84. What are graphs used to represent, and why do we use graphs?

    Asked once · last asked Sep 4 · Concept · Junior

  85. What is the flood fill algorithm, and how is it used?

    Asked once · last asked Sep 4 · Concept · Junior

  86. What should a search for nodes at distance k from a target node in a binary tree return when k is zero?

    Asked once · last asked Sep 10 · Scenario · Junior

    Other ways it was asked
    • “What should a distance-k search return when k is zero?”
  87. How would you improve a solution to the binary-tree maximum path sum problem?

    Asked once · last asked Sep 10 · Scenario · Mid-level

    Other ways it was asked
    • “What would you improve in your solution to the binary-tree maximum path sum problem?”
  88. In a 2D grid island-counting problem, how is land defined?

    Asked once · last asked Sep 10 · Concept · Junior

  89. What test case would you use to test an island-counting algorithm that considers horizontal, vertical, and diagonal connections?

    Asked once · last asked Sep 10 · Write code · Mid-level

  90. What is the Traveling Salesman Problem?

    Asked once · last asked Sep 22 · Concept · Junior

  91. What is a directed graph?

    Asked once · last asked Sep 30 · Concept · Junior

  92. For a binary heap used by a priority_queue, how is the heap stored in memory?

    Asked once · last asked Oct 4 · Concept · Junior

  93. What is the difference between a heap and a graph?

    Asked once · last asked Oct 9 · Concept · Junior

More Data Structures and Algorithms interview questions

How this list is made

Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.

Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.

The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every Data Structures and Algorithms interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.

374 interviews, 269 candidates, Sep 2025 to Oct 2026. Updated every month with new interviews.