Created
January 25, 2019 06:12
-
-
Save tsabunkar/f1e1aa6f27a9b95012885c6f420551d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] Array = {30, 20, 10, 40, 60, 50}; | |
for(int k = 0; k < Array.length; k++) { | |
int holder = Array[k]; | |
int j = k; | |
while(j > 0 && holder < Array[j - 1]) { | |
Array[j] = Array[j-1]; | |
j = j - 1; | |
Array[j] = holder; | |
} | |
} | |
for(int n = 0; n < Array.length; n++) | |
System.out.print(Array[n] + " "); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment