We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
staticvoidinsertionSort2(intn,int[]arr){// Complete this functionfor(intk=0;k<arr.length-1;k++){for(inti=0;i<arr.length-1;i++){intkey=arr[k+1];if(i==k+1)break;if(arr[i]>key){arr[k+1]=arr[i];arr[i]=key;}}for(inti=0;i<arr.length;i++){System.out.print(arr[i]+" ");}System.out.println();}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Insertion Sort - Part 2
You are viewing a single comment's thread. Return to all comments →