// Select Sort Method SelectionSort (int Arr [], int N) template
// PASS range is 0 ~ n-2 for (Pass = 0; Pass // If you find a smaller element, assign the location to SmallIndex if (Arr [J] // If SmallIndex and Pass are not in the same position //, the minimum term in the sub-table is exchanged with Arr [Pass] {TEMP = Arr [Pass]; Arr [pass] = arr [smallindex] Arr [shortindex] = TEMP;}}} / ************************************************** *********************** Double-end selection algorithm: is a variant of the sequencing algorithm above, can locate the minimum and maximum elements in each subtray and put them Since the beginning and end of the child table. *************************************************** ******************************** /// Double-end selection Sort algorithm function deselsort () Template // If SmallIndex and LeftPass are not in the same position //, the minimum item in the sub-table is exchanged with Arr [Pass] {TEMP = Arr [LeftPass]; Arr [LeftPass] = Arr [SmallIndex] Arr [shortindex] = TEMP; For (j = rightpass-1; j> leftpass; j--) if (arr [j]> arr [largeIndex]) LARGEINDEX = J; IF (LargeIndex! = rightpass) {temp = arr [rightpass]; arr [rightpass] = arr [largeIndex]; arr [largeIndex] = Temp;} // from two contracts LeftPass ; RightPass--;} // Self-editing routing algorithm function bubblesort () Implementation Template / / Start traversal process, the following standard j constitutes a sub-table, a total of N-1 sub-table for (j = n-1; j> = 0; J - J-j), never shrink from N-1 ~ 0, Take the composition sub-table 0 to N-1, 0 ~ N-2, 0 ~ N-3..0 ~ 1 {Exchanged = false; for (i = 0; I // 泡 法 排 一;>>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; // / Temporary variable for exchange elements / / Start traversal process, the following standard j constitutes a sub-table, a total of N-1 sub-table for (Pass = 0; Pass