50 likes | 62 Views
Explore fundamental data structures such as hash tables, heaps, and balanced search trees. Dive into graph theory, spanning trees, and minimum spanning trees, and learn key algorithms like Prim’s and Kruskal’s.
E N D
Course Outline • Introduction and Algorithm Analysis (Ch. 2) • Hash Tables: dictionary data structure (Ch. 5) • Heaps: priority queue data structures (Ch. 6) • Balanced Search Trees: general search structures (Ch. 4.1-4.5) • Union-Find data structure (Ch. 8.1–8.5) • Graphs: Representations and basic algorithms • Topological Sort (Ch. 9.1-9.2) • Minimum spanning trees (Ch. 9.5) • Shortest-path algorithms (Ch. 9.3.2) • B-Trees: External-Memory data structures (Ch. 4.7) • kD-Trees: Multi-Dimensional data structures (Ch. 12.6) • Misc.: Streaming data, randomization
Minimum spanning tree 2 2 1 2 10 4 1 3 7 2 4 6 1 8 4 5 6 1 weight of tree = 16 • Connected, undirected graph with weights on edges • Spanning tree: connected, hits all nodes, has no cycles • MST = spanning tree of minimum total edge weight
Cut theorem 2 2 10 4 1 1 3 2 7 2 4 8 4 5 6 6 1 1 • For any cut in the graph, the lowest-weight edge crossing the cut is in a MST. • (If ties, each lowest-weight edge is in some MST) • “Greed works.”
Prim’s algorithm 2 2 1 2 10 4 1 3 7 2 4 6 1 8 4 5 6 1 T = one vertex, no edges for i = 1 to n-1 add the cheapest edge joining T to another vertex • very similar to Dijkstra’s shortest-path algorithm • implementation: priority queue (binary heap) of edges from known to unknown vertices • time: O( |E| log |V| )
Kruskal’s algorithm 2 2 1 2 10 4 1 3 7 2 4 6 1 8 4 5 6 1 for i = 1 to n-1 add the cheapest edge that doesn’t create a cycle • implementation: priority queue (binary heap) of all edges • disjoint set union to detect cycles • time: O( |E| log |V| )