Interview Q&A · questions with model answers
Algorithms 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.
-
Why is list.pop(0) slow in Python?
List is a dynamic array; removing index 0 shifts all elements → O(n).
-
Why use a dummy head node?
Unifies edge cases when inserting/deleting near the real head so you never special-case an empty result.
-
Why narrate tradeoffs in interviews?
Shows engineering judgment: correctness first, then optimize time/space, readability, and failure modes.
-
Why resize a hash table?
Keep load factor bounded so average chain/probe lengths stay small and ops stay ~O(1).