← Questions
Data structure fundamentals: arrays, linked lists, hash tables and trees
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A coding interview question asked in Nvidia's technical phone screen, last asked Feb 2026. It tests data structures, complexity and fundamentals.
A fundamentals screen of quick computer-science questions. Answer each one precisely, with the reasoning behind every complexity.
Questions
- What are the best, average and worst time complexities of bubble sort, insertion sort, selection sort, merge sort, quicksort and heap sort? Which are stable and which sort in place?
- Compare arrays and linked lists: the cost of accessing the
ith element, inserting at the head and inserting in the middle (with and without already holding a pointer to the spot). - Walk through, step by step, what a dynamic array (
std::vector,ArrayList, a Python list) does when you insert at the front, including what happens when it is full and has to grow, and the amortized cost of appends. - What is a hash table? Describe the underlying structure, the hash function's role, how collisions are handled (chaining, open addressing) and when it resizes.
- What is the difference between a "hash table" and a "hash map", conceptually and in a language such as Java (
HashtableversusHashMap)? - What is the difference between a binary tree and a binary search tree, and what does each guarantee about lookups?
What a strong answer covers
- Correct complexities with the reason (for example quicksort's
O(n^2)worst case from bad pivots, heap sort'sO(n log n)in all cases), and stability. - The array/linked-list trade-off, including cache locality, not only big-O.
- The exact sequence for a front insert into a dynamic array: shift every element right (or allocate a larger buffer, copy, free the old one), so
O(n)per front insert, while appends are amortizedO(1)thanks to geometric growth. - Hash tables: buckets, load factor, resize and rehash, worst-case
O(n)with bad hashing; Java'sHashtablebeing synchronized and rejecting nulls,HashMapnot synchronized and allowing one null key. - The BST ordering invariant,
O(h)lookups, and why balancing (AVL, red-black) keepsh = O(log n).
Follow-ups
- Which structure would you use for a queue that needs fast inserts at both ends?
- How does a hash map that degrades to long chains get fixed (Java converts long chains to trees)?
- Why might quicksort beat merge sort in practice despite its worst case?
Where it's asked
- Nvidia · Technical phone screen · Last asked Feb 2026Live technical interview, 45 to 90 minutes; a project discussion, then a small task
What it tests
data structures · complexity · fundamentals
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
