fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. static void selectionSort(int []x){
  11. for (int i = 0; i < x.length-1; i++) {
  12. int mn=i;
  13. for (int j = i+1; j < x.length; j++) {
  14. if(x[mn]>x[j]){
  15. mn=j;
  16. }
  17. }
  18. int temp=x[i];
  19. x[i]=x[mn];
  20. x[mn]=temp;
  21. }
  22. }
  23. static void BubbleSort(int []x){
  24. boolean swap=true;
  25. for (int i = 0; i < x.length; i++) {
  26. for (int j = 0; j < x.length-1; j++) {
  27. if(x[j]>x[j+1]){
  28. int temp=x[i];
  29. x[i]=x[j];
  30. x[j]=temp;
  31. swap=false;
  32. }
  33. }
  34. if(swap){
  35. break;
  36. }
  37. }
  38. }
  39. public static void main (String[] args) throws java.lang.Exception
  40. {
  41. // your code goes here
  42. }
  43. }
Success #stdin #stdout 0.08s 54668KB
stdin
Standard input is empty
stdout
Standard output is empty