Recall & Review
beginner
What does 'Insert at Beginning' mean in a linked list?
It means adding a new node at the start (head) of the linked list, making it the first element.
Click to reveal answer
beginner
Why is inserting at the beginning of a linked list efficient?
Because it only requires changing the head pointer and the new node's next pointer, so it takes constant time O(1).
Click to reveal answer
beginner
In the code snippet: <br>new_node.next = head<br>head = new_node<br>What is happening?
The new node's next pointer is set to the current head, then the head is updated to the new node, effectively inserting it at the beginning.
Click to reveal answer
beginner
What happens to the old head node after inserting a new node at the beginning?
The old head becomes the second node because the new node points to it.
Click to reveal answer
beginner
What is the printed output after inserting 3 nodes with values 10, 20, 30 at the beginning in that order?
30 -> 20 -> 10 -> null
Click to reveal answer
What is the time complexity of inserting a node at the beginning of a singly linked list?
✗ Incorrect
Inserting at the beginning only changes pointers and does not depend on list size, so it is O(1).
After inserting a new node at the beginning, what does the head pointer point to?
✗ Incorrect
The head pointer always points to the first node, which is the new node after insertion.
Which pointer of the new node is updated during insertion at the beginning?
✗ Incorrect
The new node's next pointer is set to the old head node.
If the linked list is empty, what will the head point to after inserting a new node at the beginning?
✗ Incorrect
When the list is empty, the new node becomes the head and points to null.
What will be the output after inserting nodes with values 5, 15, 25 at the beginning in that order?
✗ Incorrect
Each new node is inserted at the beginning, so the last inserted node (25) is first.
Explain step-by-step how to insert a new node at the beginning of a singly linked list.
Think about what pointers need to change.
You got /3 concepts.
Describe how the linked list changes visually after inserting a node at the beginning.
Imagine a chain where you add a new link at the front.
You got /3 concepts.