Which operation is O(1) for an array but O(n) for a singly linked list?
- AAccessing the element at index i
- BReading the first element
- CInserting at the head
- DRemoving the head element
Which operation is O(1) for an array but O(n) for a singly linked list?
What does each node in a doubly linked list contain?
Which data structure is used to perform a level-order traversal of a tree?
How long does it take to check whether the edge (u, v) exists using an adjacency matrix?
A circular buffer (ring buffer) is commonly used to implement:
A hash table of size 7 uses h(k) = k mod 7 and linear probing. After inserting 10, where is 17 stored?
How long does it take to search for an arbitrary key in a binary min-heap of n elements?
Which data structure supports an LRU (least recently used) cache with O(1) get and put?
Full step-by-step solutions: practise this topic on examproblems.com.