💻 Coding Interview Questions
1️⃣ What is a heap?
Answer: A complete binary tree where parent nodes are greater (max-heap) or smaller (min-heap) than children.
2️⃣ Heap vs Priority Queue?
Answer: A heap is a data structure; a priority queue uses a heap to manage priorities.
3️⃣ What is a trie?
Answer: A tree used to store strings for efficient prefix searches.
4️⃣ What is dynamic array?
Answer: An array that resizes automatically when full (e.g., Python list, Java ArrayList).
5️⃣ What is a hash set?
Answer: Stores unique elements with fast lookup, using a hash table internally.
6️⃣ What is a circular queue?
Answer: A queue where the end connects back to the start to reuse empty space.
7️⃣ What is a sentinel node?
Answer: A dummy node used to simplify boundary conditions in linked lists or trees.
8️⃣ What is a graph adjacency list?
Answer: A list storing all neighbors of each vertex for efficient storage.
9️⃣ What is a graph adjacency matrix?
Answer: A 2D array representing edges; cell[i][j]=1 if edge exists.
🔟 What is complexity of inserting into a hash table?
Answer: Average O(1), worst-case O(n) if many collisions occur.
Post #1255
776
- ❤ 3