Interview Q&A · questions with model answers
Data Structures Interview Questions
Part of the study plan for: Machine Learning Engineer
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
In Python DSA interviews, explain: list vs deque for queue.
list.pop(0) is O(n); collections.deque popleft is O(1).
-
Big-Ω vs Big-Θ?
Ω lower bound; Θ tight bound when upper and lower match.
-
Time vs space tradeoff?
Use extra memory (tables, caches) to reduce runtime.
-
Stable vs unstable sort?
Stable keeps equal keys' relative order; matters for multi-key sorts.
-
In Python DSA interviews, explain: array vs list.
array module stores typed compact values; list stores pointers to objects.
-
What is the difference between a list and a tuple in Python?
Lists are mutable (can be modified after creation) while tuples are immutable.