using java
Which sorting algorithm is this, justify in detail your answer?
image of the code link below
https://lh3.googleusercontent.com/ie0xsSduZTDJ0PYd3skj43dNApdae1rKAXt1OIdkUE9WAyIrrzLndH2pbsVs_laCJ91H61wxBRopgHPcF8PayLjWHiW-Pn72ti02xxb0aNpx87tFUbT7j8lW0bL4=w655
The given code is insertion sort
Iterate from arr[1] to arr[n] over the array.
2: Compare the current element (key) to its predecessor.
3: If the key element is smaller than its predecessor, compare it to the elements before. Move the greater elements one position up to make space for the swapped element.
Get Answers For Free
Most questions answered within 1 hours.