Data structures & algorithms interview questions
Chapter-by-chapter DSA: analysis, recursion, lists, stacks, queues, trees, heaps, graphs, sorting, hashing, strings, greedy, divide & conquer and DP — with runnable programs.
0 / 411 done · 1–20 of 411
- 1. What do Big-O, Big-Omega and Big-Theta mean?Algorithm analysisTechnicalEasy
- 2. Order these growth rates: n log n, 2ⁿ, log n, n², n, 1, n!.Algorithm analysisTechnicalEasy
- 3. State the Master Theorem and apply it to merge sort.Algorithm analysisTechnicalMedium
- 4. What is amortized analysis? Explain it with a dynamic array.Algorithm analysisTechnicalMedium
- 5. What is the complexity of a loop where i doubles each time (i = 1, 2, 4, …, n)?Algorithm analysisTechnicalEasy
- 6. Recursion vs iteration: when do you prefer each?Recursion & backtrackingTechnicalEasy
- 7. Why is naive recursive Fibonacci slow, and how does memoization fix it?Recursion & backtrackingTechnicalMedium
- 8. What is backtracking? Give an example.Recursion & backtrackingTechnicalMedium
- 9. Implement insertion at the head and traversal of a singly linked list.Linked listsTechnicalEasy
- 10. How do doubly linked and circular linked lists differ from singly linked lists?Linked listsTechnicalEasy
- 11. How do you find the nth node from the end of a linked list in one pass?Linked listsTechnicalMedium
- 12. After detecting a cycle with Floyd's algorithm, how do you find where the cycle starts?Linked listsTechnicalHard
- 13. Implement a stack and explain its operations.StacksTechnicalEasy
- 14. Design a stack that returns its minimum in O(1).StacksTechnicalMedium
- 15. How do you convert an infix expression to postfix?StacksTechnicalMedium
- 16. Implement a queue using two stacks.QueuesTechnicalMedium
- 17. Why use a circular array for a queue?QueuesTechnicalMedium
- 18. What is a deque and where is it useful?QueuesTechnicalEasy
- 19. Write the recursive pre-order, in-order and post-order traversals.TreesTechnicalEasy
- 20. How do you do an in-order traversal without recursion?TreesTechnicalMedium