Insertion Sort Menggunakan Method di Java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package insertionsort;

/**
*
* @author KIREINA
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic
int i;
int data[] = {-6,-9,1,33,25,11,50,100,200,156};
System.out.println(” Sorting (INSERTION) Oleh :”);
System.out.println(” NAMA : ANGGA ARI WIJAYA”);
System.out.println(” N.I.M : 102410101070″+”\n”);
System.out.println(“Data Sebelum sorting “);

for(i = 0; i < data.length; i++)
System.out.print( data[i]+" ");
System.out.println();

insertion_srt(data, data.length);
System.out.println("Data setelah disorting:");
for(i = 0; i <data.length; i++)
System.out.print(data[i]+" ");
System.out.println();
}

public static void insertion_srt(int data[], int k){
for (int i = 1; i 0) && (data[j-1] > B)){
data[j] = data[j-1];
j–;
}
data[j] = B;
}
}
}

Satu pemikiran pada “Insertion Sort Menggunakan Method di Java

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s