- 6. Searching
Linear Search, Binary Search [Ottman/Widmayer, Kap. 3.2, Cormen et al,
- Kap. 2: Problems 2.1-3,2.2-3,2.3-5]
89
6. Searching Linear Search, Binary Search [Ottman/Widmayer, Kap. - - PowerPoint PPT Presentation
6. Searching Linear Search, Binary Search [Ottman/Widmayer, Kap. 3.2, Cormen et al, Kap. 2: Problems 2.1-3,2.2-3,2.3-5] 89 The Search Problem Provided A set of data sets telephone book, dictionary, symbol table Each dataset has a key k . Keys
89
90
4
2
1
6
9
3
5
8
10
7
91
92
1
2
3
4
5
6
7
8
9
10
93
94
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
3
4
5
1
2
6
7
8
9
10
4
1
2
3
5
6
7
8
9
10
4
1
3
2
5
6
7
8
9
10
95
96
n
n
n
n
2Try to find a closed form of T by applying the recurrence repeatedly (starting with
T(n)).
97
98
99
100
101
102
103
104
105
106
107
108
109
110
1 B ← new Array(r − l + 1) 2 i ← l; j ← m + 1; k ← 1 3 while i ≤ m and j ≤ r do 4
5
6
7 while i ≤ m do B[k] ← A[i]; i ← i + 1; k ← k + 1 8 while j ≤ r do B[k] ← A[j]; j ← j + 1; k ← k + 1 9 for k ← l to r do A[k] ← B[k − l + 1]
111
112
113
n
n
114
115
116
117
118
119
120
121
1 4 1 4 1 2
2 =: ρ.
3Expected value of the geometric distribution:
122
123
124
125
126