1Master of Computer Engineering Chiangmai University
2
3 Array salary index We can build to platform ( php code ) $salary[i] = ? EX. $salary[1] = $salary[3] = But we can’t know. Who’s salary ?
4Master of Computer Engineering Chiangmai University Array salary Sara Bob Smith John Steve Sara Bob Smith John Steve name We can build to platform ( php code ) $salary[‘name’] = ? EX. $salary[‘Smith’] = We can replace index by name
5Master of Computer Engineering Chiangmai University
6
7
8
9 trailer header nodes/positions entries Sara 11000
10Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara Bob Bob 12000
11Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara Bob Bob Smith 15000
12Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara Bob Bob Smith Steve Steve 18000
13Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara Bob Bob Smith Steve Steve
14Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara Bob Bob Smith Steve Steve 18000
15Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara Bob Bob Smith Steve Steve 18000
16Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara Bob Bob Smith Steve Steve 18000
17Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara Smith Steve 18000
18Master of Computer Engineering Chiangmai University
19Master of Computer Engineering Chiangmai University
20Master of Computer Engineering Chiangmai University
21Master of Computer Engineering Chiangmai University String Key StringString Hash Code CompressionFunctionCompressionFunction Hash Function Hash Table Addr.Addr.KeyKeyDataData
22Master of Computer Engineering Chiangmai University Figure Reference :
23Master of Computer Engineering Chiangmai University Algorithm get(k): Output: The value associated with the key k in the map, or null if there is no entry with key equal to k in the map return B[h(k)].get(k) {delegate the get to the list-based map at B[h(k)]} Algorithm put(k,v): Output: If there is an existing entry in our map with key equal to k, then we return its value (replacing it with v); otherwise, we return null t = B[h(k)].put(k,v) {delegate the put to the list-based map at B[h(k)]} if t = null then {k is a new key } n = n + 1 return t
24Master of Computer Engineering Chiangmai University Algorithm remove(k): Output: The (removed) value associated with key k in the map, or null if there is no entry with key equal to k in the map t = B[h(k)].remove(k) {delegate the remove to the list-based map at B[h(k)]} if t ≠ null then {k was found} n = n - 1 return t
25Master of Computer Engineering Chiangmai University
26Master of Computer Engineering Chiangmai University
27Master of Computer Engineering Chiangmai University
28Master of Computer Engineering Chiangmai University Figure Reference :
Pseudo-code for Insert: 29Master of Computer Engineering Chiangmai University
30Master of Computer Engineering Chiangmai University Algorithm preOrder(v) visit(v) for each child w of v preorder (w) Algorithm preOrder(v) visit(v) for each child w of v preorder (w)
31Master of Computer Engineering Chiangmai University
32Master of Computer Engineering Chiangmai University
33Master of Computer Engineering Chiangmai University
34Master of Computer Engineering Chiangmai University
35Master of Computer Engineering Chiangmai University
36Master of Computer Engineering Chiangmai University
37Master of Computer Engineering Chiangmai University
38Master of Computer Engineering Chiangmai University
39Master of Computer Engineering Chiangmai University
40Master of Computer Engineering Chiangmai University
41Master of Computer Engineering Chiangmai University
42Master of Computer Engineering Chiangmai University
43Master of Computer Engineering Chiangmai University
44Master of Computer Engineering Chiangmai University
45Master of Computer Engineering Chiangmai University
46Master of Computer Engineering Chiangmai University
47Master of Computer Engineering Chiangmai University
48Master of Computer Engineering Chiangmai University * d = size of alphabet m = size of the string parameter of the operation m = size of the string parameter of the operation
49Master of Computer Engineering Chiangmai University