According to Example 11.3.6. the maximum number of comparisons needed to perform insertion sort on an array of length five is
To find the array length five that requires maximum number of total comparisons using algorithm segment.
From the given problem
Initially given 5 elements and 5 is assigned to n. Initially set k to 2, x to
First step to compare