Documente Academic
Documente Profesional
Documente Cultură
Gazi University
Computer Engineering Department
9/24/2014
Index
Binary Search
Interpolation Search
Self-Organizing Sequential Search
9/24/2014
Locating Information
Hashing Functions
Collision Resolution
Coalesced Hashing
2
File Organization
File Organization
sequential
indexed sequential
direct
9/24/2014
File Access
sequential
sequential & direct
direct (random)
9/24/2014
9/24/2014
9/24/2014
9/24/2014
9/24/2014
Sorting
9/24/2014
Binary Search
Requires sorting
Compares the key of the sought record with the middle record of the file
Half of the file is eliminated in each turn
Computational complexity O(log2n)
Eg. the key of the sought record 17
9/24/2014
10
9/24/2014
11
9/24/2014
12
Why?
9/24/2014
Why?
13
9/24/2014
14
9/24/2014
15
Move_to_front
Essentially the same as the LRU (least recently used) paging algorithm
used by operating systems
9/24/2014
16
Eg. - Move_to_front
abcdefghijklmnoprqstvwyz
fabcdeghijklmnoprqstvwyz
ifabcdeghjklmnoprqstvwyz
lifabcdeghjkmnoprqstvwyz
elifabcdghjkmnoprqstvwyz
elifabcdghjkmnoprqstvwyz
delifabcghjkmnoprqstvwyz
idelfabcghjkmnoprqstvwyz
tidelfabcghjkmnoprqsvwyz
itdelfabcghjkmnoprqsvwyz
nitdelfabcghjkmoprqsvwyz
gnitdelfabchjkmoprqsvwyz
9/24/2014
17
Transpose
Easily implemented
9/24/2014
18
Eg. - Transpose
abcdefghijklmnoprqstvwyz
abcdfeghijklmnoprqstvwyz
abcdfegihjklmnoprqstvwyz
abcdefgihjklmnoprqstvwyz
abcedfgihjklmnoprqstvwyz
abcdefgihjklmnoprqstvwyz
abcdefighjklmnoprqstvwyz
abcdefighjklmnoprqtsvwyz
abcdeifghjklmnoprqtsvwyz
abcdeifghjklnmoprqtsvwyz
abcdeigfhjklnmoprqtsvwyz
9/24/2014
19
Count
Use it only when the counts are needed for another purpose
9/24/2014
20
0
11
Key
space
correspondence
999-99-9999
Address
space
999-99-9999
9/24/2014
21
9/24/2014
22
probable address
9/24/2014
23
Address
space
1200
999-99-9999
The function
The collision resolution method
9/24/2014
24
9/24/2014
25
Squaring
Radix conversion
9/24/2014
Polynomial hashing
Alphabetic keys
9/24/2014
27
For a given set of data, one hashing function may distribute the keys
more evenly over the address space than another
Packing factor =
total number of storage locations
9/24/2014
collisions
storage
28
9/24/2014
29
30
9/24/2014
31
(Eg.)
42 & 17 added
9/24/2014
32
Discussion
9/24/2014
33
Variants
Table Organization
9/24/2014
34
Variants
Late Insertion Standart Colesced Hashing (LISCH)
Lack of a cellar
Uses a cellar
Eg. Keys: 27, 18, 29, 28, 39, 13, 16, 42, 17
hashing function: key mod 7
35
Variants
Early Insertion Standart Colesced Hashing (EISCH)
nserts a new record into a position on the probe chain immediately after the record
srored at its home address
9/24/2014
36
Variants
Random Early Insertion Standart Colesced Hashing (REISCH)
9/24/2014
37
9/24/2014
38