Question: Question 5 ( 2 points ) Gianluca wants to sort the array arr. He writes the following Java code to do this. Which sorting algorithm
Question points
Gianluca wants to sort the array arr. He writes the following Java code to do this. Which sorting algorithm has he implemented?
void sortint arr
int n arr.length;
for int i ; i n; i
int key arri;
int j i ;
move elements of arri that are
greater than key, one position towards higher indexes
while j && arrj key
arrj arrj;
j j ;
place key in its new position
arrj key;
quicksort
insertion sort
bubble sort
merge sort
selection sort
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
