Resume from a verified prefix

A scheduler has six job durations already sorted in ascending order. It appends three new jobs, giving the array [10, 20, 30, 40, 50, 60, 15, 35, 55], with every value measured in milliseconds.


A continuation runs insertion sort beginning at index 6, using zero-based indices. It saves each key, checks preceding entries from right to left, and shifts only entries strictly greater than the key. It stops at the first entry no greater than the key or at the left edge.


Count rightward copies of existing entries as shifts; exclude writing the saved key. Count every evaluated comparison between an entry and the key, including a final false comparison when one occurs; exclude index checks.


Report three exact whole-number counts: the continuation's total shifts, the continuation's total key comparisons, and the total key comparisons if the same original nine-entry array were instead processed from index 1.

Your answers

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 Insertion Sort Questions: