90 likes | 169 Views
Skip Lists. Nov. 2, 2006. Midterm #2. Nov. 9 Thu 7pm. Pseudorandom number generator. Middle-square method (John von Neumann, 1946) Take any number, square it, remove the middle digits of the resulting number as your "random number", then use that number as the seed for the next iteration
E N D
Skip Lists Nov. 2, 2006
Midterm #2 • Nov. 9 Thu 7pm
Pseudorandom number generator • Middle-square method (John von Neumann, 1946) • Take any number, square it, remove the middle digits of the resulting number as your "random number", then use that number as the seed for the next iteration • 111101234321 2343 05489649 4896…
Pseudorandom number generator • Mersenne twister (Makoto Matsumoto and Takuji Nishimura, 1997) • Has the colossal period of 219937-1 iterations • Its output is predictable
Pseudorandom number generator • Cryptographically secure pseudorandom number generator • Blum-Blum-Shub • (Lenore Blum, Manuel Blum and Michael Shub, 1986)
Skip Lists • The main advantage of using randomization in data structure and algorithm design is that the structures and functions that result are usually simple and efficient.
Skip Lists • Page 396 Searching • Page 398 Insertion • Page 399 Removal
Skip Lists • We do not actually need to store pointers to items at the levels of the skip list above 0. • We do not actually need the above() method. In fact, we do not need the before() function either.
Maintaining the Top-most Level • Top-level capping • h = max {10, 2 } • h = 3 • Top-level freedom