Source Address: http://blog.csdn.net/byijie/article/details/8142859
Generic algorithms that I can understand from the materials of Fuzhou University
Algorithm
Min (a, B) returns the minimum value in A and B.
Max (a, B) returns the maximum value in A and B.
Fill (A, A + N, Val) fills the array with Val
Sort (A, A + N, CMP)
Stable_sort (A, A + N, CMP)
List. Sort (CMP) list-based Merge Sorting
Make_heap (A, A + N, CMP) is the largest heap by default, that is, when CMP is true, a performs a leaf.
Pop_heap (A, A + N, CMP) Move the heap top element to a [n-1] And a [0 .. N-2] is still
Push_heap (A, A + N, CMP) adds a [n-1] to heap a [0 .. n-1]
Sort_heap (A, A + N, CMP) converts heap a [n-1] to a [n-1] sorted array.
Lower_bound (A, A + N, Val) returns the first occurrence of the Val position (iterator). If this value is not found, return the confirmation of the number in this array.
Upper_bound (A, A + N, Val) returns the last position (iterator) of the occurrence position)
Max_element (A, A + N, CMP) returns the first occurrence position of the maximum value of the array (iterator)
Min_element (A, A + N, CMP)
Lexicographical_compare (A, A + N, B, B + M, CMP) Compare the sizes in alphabetical order
Swap (a, B) exchange a, B
Copy (A, A + N, B) copy a [0 .. n-1] to B [0 .. n-1]
Swap_ranges (A, A + N, B) exchange a [0... n-1] and B [0... n-1]
Unique_copy (A, A + N, B) removes redundant elements repeated in a [0... n-1] and copies them to B.