Recall & Review
beginner
What does 'Array Insertion at Beginning' mean?
It means adding a new element at the first position (index 0) of an 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 an array?
The time complexity is O(n), where n is the number of elements, because all elements need to be shifted one position to the right.
Click to reveal answer
beginner
Show the steps to insert 5 at the beginning of array [10, 20, 30].
Step 1: Shift 30 to index 3<br>Step 2: Shift 20 to index 2<br>Step 3: Shift 10 to index 1<br>Step 4: Insert 5 at index 0<br>Result: [5, 10, 20, 30]
Click to reveal answer
intermediate
What happens if the array is full when inserting at the beginning?
If the array is full, you cannot insert a new element unless you increase the array size or remove an element first.
Click to reveal answer
What is the first step when inserting an element at the beginning of an array?
✗ Incorrect
To insert at the beginning, all elements must move right to make space.
What is the time complexity of inserting at the beginning of an array with n elements?
✗ Incorrect
All n elements need to be shifted, so it takes O(n) time.
If an array has elements [1, 2, 3] and we insert 0 at the beginning, what is the new array?
✗ Incorrect
The new element 0 is added at the start, shifting others right.
What must be true about the array size to insert a new element at the beginning?
✗ Incorrect
There must be space to add a new element; otherwise insertion is not possible.
Which data structure allows easier insertion at the beginning than an array?
✗ Incorrect
Linked lists allow insertion at the start without shifting elements.
Explain how to insert an element at the beginning of an array and why shifting elements is necessary.
Think about how arrays store elements in fixed positions.
You got /4 concepts.
Describe what happens if you try to insert at the beginning of a full array and how to handle it.
Consider array size and memory limits.
You got /4 concepts.
