Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. public static void bubbleSortKleinNaarGroot() {
  2. {
  3.  
  4.  
  5. int[] array = {7, 3, 8, 1, 2, 5, 4, 6, 9, 0};
  6.  
  7.  
  8. int temp;
  9. int j, index;
  10. System.out.println("voor sort staat er op plek 0 de waarde " + array[0]);
  11. for (j = 0; j < array.length - 1; j++) {
  12. for (index = 0; index < array.length - 1; index++) {
  13. if (array[index] > array[index + 1]) {
  14. temp = array[index];
  15. array[index] = array[index + 1];
  16. array[index + 1] = temp;
  17.  
  18. }
  19. }
  20. }
  21. System.out.println("voor sort staat er op plek 0 de waarde " + array[0]);
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement