Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void bubbleSortKleinNaarGroot() {
- {
- int[] array = {7, 3, 8, 1, 2, 5, 4, 6, 9, 0};
- int temp;
- int j, index;
- System.out.println("voor sort staat er op plek 0 de waarde " + array[0]);
- for (j = 0; j < array.length - 1; j++) {
- for (index = 0; index < array.length - 1; index++) {
- if (array[index] > array[index + 1]) {
- temp = array[index];
- array[index] = array[index + 1];
- array[index + 1] = temp;
- }
- }
- }
- System.out.println("voor sort staat er op plek 0 de waarde " + array[0]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement