Download presentation
Presentation is loading. Please wait.
1
CS Fall 2012, Lab 11 Haohan Zhu
2
Hashing Space & Time Tradeoff O(n/m) for searching
CS Fall 2012, Lab 11 4/30/2019 Hashing Space & Time Tradeoff O(n/m) for searching Design Hashing Function Key Hash Code => Table Index Deal with Collisions: Separate Chaining Linear Probing
3
Hashing in Java Hash Code hashCode() is a method in Java
CS Fall 2012, Lab 11 4/30/2019 Hashing in Java Hash Code hashCode() is a method in Java String: s[0]*31^(n-1) + s[1]*31^(n-2) s[n-1] Integer: equal to the primitive int value Double: (int)(v^(v>>>32)) Always an int value
4
R-B Tree and Hash Table in Java
CS Fall 2012, Lab 11 4/30/2019 R-B Tree and Hash Table in Java Red-Black Tree: TreeMap<K,V> Hash Table: HashMap<K,V>
5
Graph Vertices: V Edges: E Representation Adjacency list
CS Fall 2012, Lab 11 4/30/2019 Graph Vertices: V Edges: E Representation Adjacency list Adjacency matrix Adjacency sets
6
Graph Traversal Depth-first traversal Stack Breadth-first traversal
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal Depth-first traversal Stack Breadth-first traversal Queue
7
Graph Traversal DFS Stack B E C A F D G CS 112 - Fall 2012, Lab 11
4/30/2019 Graph Traversal DFS B E C A F D G Stack
8
Graph Traversal DFS A Stack B E C A F D G CS 112 - Fall 2012, Lab 11
4/30/2019 Graph Traversal DFS B E C A F A D G Stack
9
Graph Traversal DFS B A Stack B E C A F D G CS 112 - Fall 2012, Lab 11
4/30/2019 Graph Traversal DFS B E C A F B A D G Stack
10
Graph Traversal DFS C B A Stack B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal DFS B E C A F C B A D G Stack
11
Graph Traversal DFS D C B A Stack B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal DFS B E D C A F C B A D G Stack
12
Graph Traversal DFS D C B A Stack B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal DFS B E D C A F C B A D G Stack
13
Graph Traversal DFS E B A Stack B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal DFS B E C A F E B A D G Stack
14
Graph Traversal DFS F E B A Stack B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal DFS B E F C A F E B A D G Stack
15
Graph Traversal DFS G F E B A Stack B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal DFS B E G F C A F E B A D G Stack
16
Graph Traversal DFS G F E B A Stack B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal DFS B E G F C A F E B A D G Stack
17
Graph Traversal BFS Queue B E C A F D G CS 112 - Fall 2012, Lab 11
4/30/2019 Graph Traversal BFS B E C A F D G Queue
18
Graph Traversal BFS Queue B E C A F D G CS 112 - Fall 2012, Lab 11
4/30/2019 Graph Traversal BFS B E C A F D G Queue
19
Graph Traversal BFS B Queue B E C A F D G CS 112 - Fall 2012, Lab 11
4/30/2019 Graph Traversal BFS B E B C A F D G Queue
20
Graph Traversal BFS B D Queue B E C A F D G CS 112 - Fall 2012, Lab 11
4/30/2019 Graph Traversal BFS B E B D C A F D G Queue
21
Graph Traversal BFS B D G Queue B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal BFS B E B D G C A F D G Queue
22
Graph Traversal BFS B D G Queue B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal BFS B E B D G C A F D G Queue
23
Graph Traversal BFS D G C Queue B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal BFS B E D G C C A F D G Queue
24
Graph Traversal BFS D G C E Queue B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal BFS B E D G C C A F E D G Queue
25
Graph Traversal BFS D G C E Queue B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal BFS B E D G C C A F E D G Queue
26
Graph Traversal BFS G C E Queue B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal BFS B E G C E C A F D G Queue
27
Graph Traversal BFS C E F Queue B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal BFS B E C E F C A F D G Queue
28
Graph Traversal BFS C E F Queue B E C A F D G
CS Fall 2012, Lab 11 4/30/2019 Graph Traversal BFS B E C E F C A F D G Queue
29
Graph Traversal BFS E F Queue B E C A F D G CS 112 - Fall 2012, Lab 11
4/30/2019 Graph Traversal BFS B E E F C A F D G Queue
30
Graph Traversal BFS F Queue B E C A F D G CS 112 - Fall 2012, Lab 11
4/30/2019 Graph Traversal BFS B E F C A F D G Queue
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.