Professional Documents
Culture Documents
L 10 (April - 17 - 2016)
L 10 (April - 17 - 2016)
L 10 (April - 17 - 2016)
Lecture #10
Spring 2016
2
Case Study: [Data Processing] Students’ Grading ASTU
3
ASTU
4
ASTU
2 100 0 100 0
3 82 94 73 86
4 64 74 84 94
5 94 84 74 64
5
Searching and Sorting ASTU
6
Search Algorithms ASTU
8
Linear Search ASTU
9
Linear Search ASTU
10
Binary Search ASTU
11
Binary Search ASTU
12
Binary Search ASTU
13
Binary Search ASTU
14
Binary Search ASTU
15
Linear and Binary Search ASTU
16
Sort Algorithms ASTU
17
Selection Sort ASTU
18
Selection Sort ASTU
19
Selection Sort ASTU
20
Selection Sort ASTU
21
Selection Sort ASTU
22
Exchange (Bubble) Sort ASTU
• Number of comparisons
O(n2)
• Maximum number of comparisons
n(n-1)/2
• Maximum number of moves
n(n-1)/2
• Many moves are not final moves
25
Dynamic Array Allocation ASTU
26
Dynamic Array Allocation ASTU
27
Dynamic Array Allocation ASTU
28
Dynamic Array Allocation Example ASTU
29
Pointer: Output Exercises ASTU
30
Pointer: Output Exercises ASTU
31