-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathw2d3
58 lines (45 loc) · 1.63 KB
/
w2d3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
HASHES and GRAPHS
hash function
md5
input of infinite domain (set) -> retuen an outpur within a fixed range
0 - 2^64 range for 64 bit machines
hashtable (hashmap_)
simepliest way -> take unumberlinea nd make it cirular ( modulo)
need tto look up values weve stored before
- deterministic
COLLISIONS - infiniately many collisions since input size is inifite
should be as uniformly distributed as possible - HIGH Z SQUARED SCORE - OUTPUT
PROBLEM input could not be evenly distributed - ie dictinary or phone book
NON CLUSTERING - clustered input should not be clusrtered in output
WANT ALL btis of intput to contribute to some part of output - other wise clustering again
RABIN_KARP
cn^(k-1) + ..... cn(k*0) % size of set
colissions - expand set, going to be O(n) operations to resize hashmap
other opsions every bucket is acually the start of a linked list
- store key for lookup and value
BLOOM FILTERS
GRAPHS
serires of internconnected lsit
ant node can have as many refernces and can be linked to ay other nodes
graph as no real root
nodes -> vertices
EDGDES CAN HAVE VALUES - vertices adjoining,metadata abotu connevtion
links - edgdes
runtime compoxities - related to edges and vertices
O(VE)
directed (twitter) undirected(facebook)
adjacency list
adjacency matrix
incidence matrix
no root
instead can have a lsit of edges and nodes - Al
represent strucure as lsit of vertices and antother list of tings they are adjacent to
Adjacent matrix
add vertice
remove vertices
cerate connection
remove connection
get vauels associated to vertix
change edge values
adjacent - gievn two nodes are they adjacent
neighbors, given a node what is adjacent