Question: Worst case in insertion happens when the array is in reverse when sorted. For the length 5 the sorted order will be 5, 4, 3,


Worst case in insertion happens when the array is in reverse when sorted. For the length 5 the sorted order will be 5, 4, 3, 2, 1 Recursion Tree Insertion Sort Shows Index 1 (5, 4, 3, 2, 1) Failed recursion call due to j>0 condition violation 4,3,5 3,4,5 3,4,5 3,4,2,5 4 3,2,4,5 2,3,4,5 2,3,4,1,5 2,3,4,5 2,3,1,4,5 2,1,3,4,5 1,2,3,4,5 1,2,3,4,5 Worst case in insertion happens when the array is in reverse when sorted. For the length 5 the sorted order will be 5, 4, 3, 2, 1 Recursion Tree Insertion Sort Shows Index 1 (5, 4, 3, 2, 1) Failed recursion call due to j>0 condition violation 4,3,5 3,4,5 3,4,5 3,4,2,5 4 3,2,4,5 2,3,4,5 2,3,4,1,5 2,3,4,5 2,3,1,4,5 2,1,3,4,5 1,2,3,4,5 1,2,3,4,5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
