English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

資料結構的排序方式有那些呢?
請介紹一些來看看吧!^^

2005-01-15 17:22:00 · 3 個解答 · 發問者 永遠等她 6 in 電腦與網際網路 軟體

麻煩寫每一種的特性!

2005-01-18 06:57:46 · update #1

3 個解答

Selection Sort:The selection sort algorithm sorts a list by selection the smallest element in the (unsorted portion of the) list, and then moving this smallest element to the top of the (unsorted)list.

the number of key comparisons:O(n^2)

Insertion Sort:Reduce number of key comparisons made in selection sort

the number of key comparisons:O(n^2)
the number of swap:O(n)

Quick sort:
List it partitioned into 2 sublists, and the 2 sublists are then sorted and combined into one list in such way so that the combined list is sorted

key comparions:(AVG case)..........O(n*log n) (Worst case)......O(n^2)
swap :(AVG case)..........O(n*log n) (Worst case)......O(n^2)

Merge sort:
Merge sort algorithm also partitions the list into 2 sublists, sort the sublists, and then combines the sorted sublists into one sorted list

key comparisons:
O(n*log 2n)

Heap Sort:
Def:A heap is a list in which each element contains a key, such that the key in the element at position k in the list is at least as large as the key int the element at position 2k+1(if it exits), and 2k+2(if it exits)

2005-01-24 23:19:33 · answer #1 · answered by ? 2 · 0 0

請參考:http://www.cyut.edu.tw/~ckhung/b/al/sort1.shtml

2005-01-24 06:16:16 · answer #2 · answered by 志榮 2 · 0 0

Quick Sort, Selection Sort, Heap Sort, Insertion Sort, Bubble Sort, Binary Tree Sort, Radix Sort ...

2005-01-15 18:03:53 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers