INTRODUCTION TO PROGRAM DESIGN
Lecture 12: Standard Library Algorithms
Yun-Shan Hsieh (謝昀珊),
Department of Computer Science and Information Engineering, NCKU
Acknowledgement: Slides template by https://slidesgo.com
Lambda Expressions
2
Lambda Expressions (Cont.)
3
fill, fill_n, generate & generate_n
4
fill, fill_n, generate & generate_n (Cont.)
5
fill, fill_n, generate & generate_n (Cont.)
6
fill, fill_n, generate & generate_n (Cont.)
7
equal, mismatch and
lexicographical_compare
8
equal, mismatch and
lexicographical_compare (Cont.)
9
equal, mismatch and
lexicographical_compare (Cont.)
10
equal, mismatch and
lexicographical_compare (Cont.)
11
remove, remove_if, remove_copy and
remove_copy_if
12
remove, remove_if, remove_copy and
remove_copy_if (Cont.)
13
remove, remove_if, remove_copy and
remove_copy_if (Cont.)
14
remove, remove_if, remove_copy and
remove_copy_if (Cont.)
15
replace, replace_if, replace_copy
and replace_copy_if
16
replace, replace_if, replace_copy
and replace_copy_if (Cont.)
17
replace, replace_if, replace_copy
and replace_copy_if (Cont.)
18
replace, replace_if, replace_copy
and replace_copy_if (Cont.)
19
Mathematical Algorithms
20
Mathematical Algorithms (Cont.)
21
Mathematical Algorithms (Cont.)
22
Mathematical Algorithms (Cont.)
23
Mathematical Algorithms (Cont.)
24
Basic Searching and Sorting Algorithms
25
Basic Searching and Sorting Algorithms (Cont.)
26
Basic Searching and Sorting Algorithms (Cont.)
27
Basic Searching and Sorting Algorithms (Cont.)
28
Basic Searching and Sorting Algorithms (Cont.)
29
Basic Searching and Sorting Algorithms (Cont.)
30
Basic Searching and Sorting Algorithms (Cont.)
31
swap, iter_swap and swap_ranges
32
swap, iter_swap and swap_ranges (Cont.)
33
swap, iter_swap and swap_ranges (Cont.)
34
copy_backward, merge, unique and
reverse
35
copy_backward, merge, unique and
reverse (Cont.)
36
copy_backward, merge, unique and
reverse (Cont.)
37
inplace_merge, unique_copy and
reverse_copy
38
inplace_merge, unique_copy and
reverse_copy (Cont.)
39
inplace_merge, unique_copy and
reverse_copy (Cont.)
40
Set Operations
41
Set Operations (Cont.)
42
Set Operations (Cont.)
43
Set Operations (Cont.)
44
Set Operations (Cont.)
45
lower_bound, upper_bound and
equal_range
46
lower_bound, upper_bound and
equal_range (Cont.)
47
lower_bound, upper_bound and
equal_range (Cont.)
48
lower_bound, upper_bound and
equal_range (Cont.)
49
lower_bound, upper_bound and
equal_range (Cont.)
50
min, max, minmax and minmax_element
51
min, max, minmax and minmax_element (Cont.)
52
min, max, minmax and minmax_element (Cont.)
53
Function Objects
54
Function Objects (Cont.)
55
Function Objects (Cont.)
56
Function Objects (Cont.)
57
Function Objects (Cont.)
58
Function Objects (Cont.)
59
Standard Library Algorithm Summary
60
Standard Library Algorithm Summary (Cont.)
61
Standard Library Algorithm Summary (Cont.)
62
Standard Library Algorithm Summary (Cont.)
63
References
• https://en.cppreference.com/w/cpp/header/cmath
• https://en.cppreference.com/w/cpp/chrono/c/time
64
Thank You Very Much!
Questions & Answers?
65