What happens when you insert a new node at the beginning of a singly linked list?
Think about how the head pointer changes when adding at the start.
Inserting at the beginning means the new node points to the current head, then the head is updated to the new node.
What is the time complexity of deleting an element from the middle of an array?
Consider what happens to elements after the deleted position.
Deleting from the middle requires shifting all elements after it one position left, which takes linear time.
Given the sequence of numbers inserted into an empty binary search tree: 10, 5, 15, 3, 7, 12, 18, which statement is true about the tree's shape?
Visualize the insertion process step-by-step.
Inserting 10, 5, 15, 3, 7, 12, 18 creates a balanced BST: root 10, left subtree (5,3,7) and right (15,12,18), with similar heights but not perfectly balanced.
Which advantage does a doubly linked list have over a singly linked list when deleting a node given a pointer to that node?
Think about how you find the previous node in each list type.
In a doubly linked list, each node has a pointer to its previous node, so deletion can be done directly without traversal.
Consider a hash table using chaining for collision resolution. If keys are inserted in ascending order and the hash function is key modulo table size, which scenario is most likely?
Think about how modulo operation distributes sequential keys.
Sequential keys (ascending order) modulo table size hash to 0, 1, 2, ..., m-1 cycling evenly across all buckets/chains, minimizing collisions.