Updating an indexed customer list

A scheduling application stores customer names in an array with space for seven names. Initially, four positions are occupied in this order: Mira, Owen, Priya, Sami. Unused positions follow the occupied positions.


An index is the number identifying a position. Indexing starts at 0, so Mira initially occupies index 0.


Apply these operations in the stated order:

  1. Insert Noor at index 1, shifting the names previously at that position and later positions one place to the right.
  2. Remove the name currently at index 3, shifting later names one place to the left to close the gap.
  3. Replace the name currently at index 2 with Luis, without inserting another element.

Complete the table after each operation. Enter exact integers for the active count and the customer names for the indexed positions. Each operation acts on the result of the preceding operation.

Operation completedActive countName at index 1Name at index 2Name at index 3
Insert Noor at index 1
Remove current index 3
Replace current index 2 with Luis

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Data Structures Questions: