Selasa, 24 Januari 2012

Marge Sort

PROGRAM JAVA PADA MARGE SORT




Source Code Marge Sort

 Dibawah Ini Source Code Dari Marge Sort :
-------------------------------------------------------------------------------------------------------
Source Code

 

package sorting;

import javax.swing.JOptionPane;

/**
 *
 * @author LA TAHZAN
 */
public class marge {
    String input="";
    String[] angka;

    String split=",";
public void inputan(){

    input=JOptionPane.showInputDialog("Input Data : ");
    angka=input.split(split);
    //
    System.out.println("Values Sebelum Disortir:\n");
    for(int i =0; i < angka.length ; i++)
    System.out.print(angka[i] + " ");
    //JOptionPane.showMessageDialog(null,"Values after the sort:\n" + angka[i]+" ");

    insertion_srt(angka, angka.length);
System.out.println("\n\nValues Setelah Di Sortir:\n");
for(int i = 0; i  0) && (Integer.valueOf(array[j-1]) > B)){
array[j] = array[j-1];
j--;
}
array[j] = String.valueOf(B);
}

    }
}



-------------------------------------------------------------------------------------------------------------
 Dibawah ini class untuk menjalankannya :
-------------------------------------------------------------------------------------------------------
Source Code

 

package sorting;

/**
 *
 * @author LA TAHZAN
 */
public class run_marge {
    public static void main (String args[]){

    marge x = new marge();
    x.inputan();

}

}


-------------------------------------------------------------------------------------------------------------

Tidak ada komentar:

Posting Komentar