Classic Sorting Algorithm Summary (CODE)
· Bubble Method
· Quick sorting
· Insert sorting
· Shell sorting
· Select sorting
· Heap sorting
· Merge Sorting
Appendix:
Principle of Sorting Algorithm: http://zh.wikipedia.org/wiki/Category:%E6%8E%92%E5%BA%8F%E7% AE %97%E6%B3%95
Flash Demo: http://www.tyut.edu.cn/kecheng1/site01/suanfayanshi/list.asp? Id = 7
The details of Merge Sorting are described in the following article:
Recursive Algorithm learning-Merge Sorting
[CPP] view plaincopyprint? # Include <iostream> # include <string> using namespace STD;/* compared to the left and right elements of the bubble method, bubble up later */template <typename T> void bubblesort (T * r, int N) {T temp; int I, j; for (I = 0; I <n-1; I ++) {for (j = 0; j <n-i-1; j ++) {If (R [J]> r [J + 1]) {temp = R [J]; R [J] = R [J + 1]; R [J + 1] = temp ;}}# include <iostream >#include <string> using namespace STD;/* compared to the left and right elements of the bubble method, bubble up later */template <typename T> void bubblesort (T * r, int N) {T TEM P; int I, j; for (I = 0; I <n-1; I ++) {for (j = 0; j <n-i-1; j ++) {If (R [J]> r [J + 1]) {temp = R [J]; R [J] = R [J + 1]; R [J + 1] = temp ;}}} [CPP] view plaincopyprint? /* The left side of quick sorting is smaller than him, and the right side is larger than him. Each time you get a leftmost Data Location */template <typename T> void quicksort (t a [], int low, int high) {If (low