Download presentation
Presentation is loading. Please wait.
Published byDustin Barker Modified over 9 years ago
1
1Master of Computer Engineering Chiangmai University
2
2
3
3 Array salary 0 1 2 3 4 index We can build to platform ( php code ) $salary[i] = ? EX. $salary[1] = $salary[3] = But we can’t know. Who’s salary ? 11000 20000
4
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. 15000
5
5Master of Computer Engineering Chiangmai University
6
6
7
7
8
8
9
9 trailer header nodes/positions entries Sara 11000
10
10Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara 11000 Bob 12000 Bob 12000
11
11Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara 11000 Bob 12000 Bob 12000 Smith 15000
12
12Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara 11000 Bob 12000 Bob 12000 Smith 15000 Steve 18000 Steve 18000
13
13Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara 11000 Bob 12000 Bob 12000 Smith Steve 18000 Steve 18000 20000 15000
14
14Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara 11000 Bob 12000 Bob 12000 Smith 20000 Steve 18000 Steve 18000
15
15Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara 11000 Bob 12000 Bob 12000 Smith 20000 Steve 18000 Steve 18000
16
16Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara 11000 Bob 12000 Bob 12000 Smith 20000 Steve 18000 Steve 18000
17
17Master of Computer Engineering Chiangmai University trailer header nodes/positions entries Sara 11000 Smith 20000 Steve 18000
18
18Master of Computer Engineering Chiangmai University
19
19Master of Computer Engineering Chiangmai University
20
20Master of Computer Engineering Chiangmai University
21
21Master of Computer Engineering Chiangmai University String Key StringString Hash Code CompressionFunctionCompressionFunction Hash Function Hash Table Addr.Addr.KeyKeyDataData
22
22Master of Computer Engineering Chiangmai University Figure Reference : http://th.wikipedia.org/
23
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
24
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
25
25Master of Computer Engineering Chiangmai University
26
26Master of Computer Engineering Chiangmai University
27
27Master of Computer Engineering Chiangmai University
28
28Master of Computer Engineering Chiangmai University Figure Reference : http://en.wikipedia.org
29
Pseudo-code for Insert: 29Master of Computer Engineering Chiangmai University
30
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)
31
31Master of Computer Engineering Chiangmai University
32
32Master of Computer Engineering Chiangmai University
33
33Master of Computer Engineering Chiangmai University
34
34Master of Computer Engineering Chiangmai University
35
35Master of Computer Engineering Chiangmai University
36
36Master of Computer Engineering Chiangmai University
37
37Master of Computer Engineering Chiangmai University
38
38Master of Computer Engineering Chiangmai University
39
39Master of Computer Engineering Chiangmai University
40
40Master of Computer Engineering Chiangmai University
41
41Master of Computer Engineering Chiangmai University
42
42Master of Computer Engineering Chiangmai University
43
43Master of Computer Engineering Chiangmai University
44
44Master of Computer Engineering Chiangmai University
45
45Master of Computer Engineering Chiangmai University
46
46Master of Computer Engineering Chiangmai University
47
47Master of Computer Engineering Chiangmai University
48
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
49
49Master of Computer Engineering Chiangmai University
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.