Careermaxxing
All roadmaps

DSA FAQ 150

150 frequently-asked data structures, algorithms, and CS-fundamentals interview questions with concise answers, grouped by topic: complexity, arrays and strings, linked lists, stacks and queues, trees, graphs, dynamic programming, object-oriented programming, operating systems, databases, and networking. Free to read, no signup required.

How to use this: each section is collapsed by default, tap a topic to open it. Treat the answers as a quick refresher for concepts you already understand, not a substitute for actually solving problems. If a topic feels shaky, that is a signal to go practice it, not just memorize the answer here.

What does Big-O notation describe?

Big-O describes how an algorithm's running time or memory use grows as the input size grows, focusing on the worst case and dropping constants and lower-order terms.

What is the difference between O(n) and O(log n)?

O(n) time grows in direct proportion to input size, while O(log n) time grows much more slowly because the algorithm shrinks the problem at each step, like binary search halving the range.

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

O(1). Arrays store elements in contiguous memory, so the address of any index is computed directly.

What is the time complexity of searching an unsorted array?

O(n) in the worst case, since every element may need to be checked.

What is amortized time complexity?

The average time per operation over a sequence of operations, even if a single operation is occasionally expensive, as with dynamic array resizing during append.

What is the difference between time complexity and space complexity?

Time complexity measures how runtime scales with input size; space complexity measures how memory use scales with input size, including any extra structures the algorithm allocates.

Why do we usually care about worst-case complexity rather than best-case?

Worst-case complexity gives a reliable upper bound on how an algorithm will behave, which matters more for planning and guarantees than a best case that might rarely occur.

What is the time complexity of a nested loop over the same array?

O(n squared) in general, since the inner loop runs n times for each of the n iterations of the outer loop.

Want a plan built around your actual gaps?

This reference covers the concepts. Interview Ready turns practice into a personalized 30-day plan built around your resume and a specific target role, with real questions in the right order and a guided Build-a-Project track alongside it. Start free.

Other roadmaps