The sorting algorithm is the content of the data structure discipline, in which the internal sorting existing algorithms have many kinds, what is the characteristics of each? This brings graph design realizes the commonly used internal sorting algorithm and compares. Sort by bubbling, direct insertion, simply sequencing, rapid sorting, stack sorting, test comparison for the number of comparisons of keywords, and number of movements. Problem analysis and overall design ADT ORDERABLIST {data object: D = {Ai | Ai∈integerseet, i = 1, 2, ..., n, n ≥ 0} Data relationship: r1 = { | ai- 1, Ai∈D, I = 1, 2, ..., N} Basic Operation: Initlist (n) Operation Result: Constructing a length of N, element value is 1, 2, ... N, N, ... Randomizel (D, isinverSeorser) Operation Result: Random Discharge BubbleSort () Operation Result: Bubbling Sort Insersort () Operation Result: Sort Sort SelectSort () Operation Result: Sort QUICKSORT () Operation Result: Fast Sorting Heapsort () Operation: Pile Sort ListTraverse (Visit ()) Operation Result: Convergence the function visit ()} ADT ORDERABLIST to be integrated in sequential sequence, in front, reverse order and Different data on different data, test comparisons for test comparisons, the number of comparisons and movements of keywords (keyword exchange gauges 3 times move). Require display information, users enter the designer of the table by the keyboard ( 100-1000) and the number of different test data (8-18). Each test is completed, requiring the column performance to be compared. Requires analysis of the results. Detailed design 1, bubble sorting algorithm: Core thinking is to scan data list Looking for two adjacent items that appear in downtimes. When these two projects are found, the location of the project is swapped and then continues to scan. Repeat the above operation until all items are placed in sequence Bubblesort (Struct REC R [], INT N) {INT I, J; Struct REC W; unsigned long int compare = 0, MOVE = 0; for (i = 1 ; i <= n-1; i ) for (j = n; j> = i 1; j -) {if (r [j] .key
R [k] .key) {k = j; Compare ;} w = r [i]; r [i] = r [k]; r [k] = W; Move = Move 3;}} printf (" / nselectsort compare =% ld, move =% ld / n ", compare, move);} 4, fast sort algorithm: first check the number of data in the data list, if less than two, exit the program directly. If there are more than two data, select a split point to divide the data into two parts, less than the split point of the data is placed in one group, and the rest is placed in another group, and then sorted two sets of data. Usually the data of the split point is randomly selected. This is similar to whether your data has been arranged, the size of the two word lists you divide is almost almost. As long as the size of the two sub-lists is almost Q (struct REC R [], INT S, INT T) {INT I = S, J = T; if (S
I &&r [j] .key> = r [0] .key) {j -; a;} if (i