Counting moves across two edits

A zero-based list occupies the first 37 slots of an array with capacity 50. First insert a new entry at index 11, then remove the entry at index 28 of the updated list. Both operations preserve consecutive storage and do not resize the array. Count only moves of existing entries by one slot to preserve order, excluding the write of the new entry. How many such moves occur in total? Give an exact integer number of moves, to zero decimal places.

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 List ADT Questions: