0

how many iteration on the last loop?

esp on this part >>> for(int i=0;i<editedArray.length-1;i++){ if (editedArray[i]<editedArray[i+1]){ temp=editedArray[i]; editedArray[i]=editedArray[i+1]; editedArray[i+1]=temp; flag=true; } } if we gave 81, 26, 15, 5, 106 as input how many times for loop here ? ( check the code to get it) https://code.sololearn.com/cNyou0yG8qwh/?ref=app

21st Sep 2017, 5:21 PM
Hmmam Babe khuoja
Hmmam Babe khuoja - avatar
1 Odpowiedź
+ 4
start 81 26 15 5 106 1st 26 15 5 81 106 2nd 15 5 26 81 106 3rd 5 15 26 81 106 4th 5 15 26 81 106 4 loops of while before flag stays false
22nd Sep 2017, 12:20 PM
John Wells
John Wells - avatar