Recall & Review
beginner
What does 'inserting at the beginning of an array' mean?
It means adding a new element at the first position (index 0) of the array, shifting all other elements one position to the right.
Click to reveal answer
beginner
Why do we need to shift elements when inserting at the beginning of an array?
Because arrays have fixed positions, to insert at the start, all existing elements must move one step right to make space for the new element.
Click to reveal answer
intermediate
What is the time complexity of inserting an element at the beginning of a normal array?
The time complexity is O(n), where n is the number of elements, because all elements must be shifted one position to the right.
Click to reveal answer
beginner
Show the array after inserting 5 at the beginning of [10, 20, 30].
The new array will be [5, 10, 20, 30]. The existing elements shift right to make space.
Click to reveal answer
beginner
What Python list method can insert an element at the beginning?
The list method insert(0, value) inserts 'value' at index 0, which is the beginning of the list.
Click to reveal answer
What happens to existing elements when you insert at the beginning of an array?
✗ Incorrect
When inserting at the beginning, all elements move right to make space for the new element.
Which index is used to insert an element at the beginning of a Python list?
✗ Incorrect
Index 0 is the first position in a list, so inserting at index 0 adds the element at the beginning.
What is the time complexity of inserting at the beginning of an array?
✗ Incorrect
Because all elements must shift, the operation takes linear time proportional to the number of elements.
Which Python list method inserts an element at a specific position?
✗ Incorrect
The insert() method adds an element at a given index, shifting others as needed.
After inserting 7 at the beginning of [3, 4, 5], what is the new array?
✗ Incorrect
Inserting 7 at the start places it at index 0, pushing others right.
Explain step-by-step how to insert an element at the beginning of an array.
Think about moving elements to make space.
You got /3 concepts.
Describe the impact on performance when inserting at the beginning of a large array.
Consider how many elements move.
You got /3 concepts.