Sedikit Catatan Tentang Sorting Algorithm
Sorting algorithm adalah sebuah algoritma untuk menyortir elemen yang ada pada sebuah urutan acak untuk menghasilkan urutan yang pasti. Singkat kata, sorting algorithm mengurutkan suatu urutan yang masih acak.
Ada beberapa Sorting algortihm, yaitu :
Ada beberapa Sorting algortihm, yaitu :
Bubble Sort
Mengurutkan dengan cara membandingkan dua urutan pertama, lalu urutan yang lebih kecil dipindahkan ke kanan. Begitu seterusnya hingga semua elemen terurut.
Insertion Sort
Start with a sorted list of 1 element on the left, and N-1 unsorted items on the right. Take the first unsorted item (element #2) and insert it into the sorted list, moving elements as necessary. We now have a sorted list of size 2, and N -2 unsorted elements. Repeat for all elements.
Selection Sort
Menyisir semua elemen dan menemukan yang paling kecil. Kemudian di tukar ke posisi pertama.
Merge Sort
Merge sort takes advantage of the ease of merging already sorted lists into a new sorted list. It starts by comparing every two elements (i.e., 1 with 2, then 3 with 4...) and swapping them if the first should come after the second. It then merges each of the resulting lists of two into lists of four, then merges those lists of four, and so on; until at last two lists are merged into the final sorted list.[16] Of the algorithms described here, this is the first that scales well to very large lists, because its worst-case running time is O(n log n). It is also easily applied to lists, not only arrays, as it only requires sequential access, not random access. However, it has additional O(n) space complexity, and involves a large number of copies in simple implementations.
dan lain-lain...
More references :
http://betterexplained.com/articles/sorting-algorithms/
https://en.wikipedia.org/wiki/Sorting_algorithm
https://www.cs.cmu.edu/~adamchik/15-121/lectures/Sorting%20Algorithms/sorting.html
Demos :
http://www.sorting-algorithms.com/
http://cs.smith.edu/~thiebaut/java/sort/demo.html
More references :
http://betterexplained.com/articles/sorting-algorithms/
https://en.wikipedia.org/wiki/Sorting_algorithm
https://www.cs.cmu.edu/~adamchik/15-121/lectures/Sorting%20Algorithms/sorting.html
Demos :
http://www.sorting-algorithms.com/
http://cs.smith.edu/~thiebaut/java/sort/demo.html
Comments
Post a Comment