The so-called sorting is to organize records in the file, which is arranged in the order of keywords (or decreasing). It is defined as follows: Enter: N records R1, R2, ..., RN, which correspond to K1, K2, ..., KN, respectively. Output: RIL, RI2, ..., RIN such as Ki1 ≤ Ki2 ≤ ... ≤ Kin. (Or Ki1 ≥ Ki2 ≥ ... ≥ kin).
Here, we briefly introduce several sorting methods, direct insertion, Hidden sort, bubble sorting, rapid sorting, direct selection, code mentioned in the text, is passed under IE6.
Direct Insert Sort Basic Thought Assume that the records to be sorted is stored in the array r [1..n]. Initially, R [1] has one ordered zone, and the disorder zone is R [2..n]. From i = 2 until I = N, R [I] is inserted into the current ordered zone R [1..i-1] to generate an ordered zone containing N records.
Algorithm Description Function INSERTSORT (ARR) {// Insert Sort -> Direct Insert Method Sorting Var ST = New Date (); Var Temp, J; For (VAR i = 1; I