COMPSCI 61B Lecture Notes - Lecture 24: Prims, Binary Heap, Dream Evil

28 views6 pages
16 Apr 2019
School
Professor

Document Summary

Given an undirected graph, determing if it contains any cycles. May use any data structure or algorithm from the course. Approach 1: do dfs from 0 (arbitrary vertex) Keep going until you see a marked vertex. 1 looks back at 0 and sees marked. Solution: just don"t count the node you come from. For each edge, check if the 2 vertices are connected. Worse case runtime: o(v+elog*(v)) if we have path compression. Given an undirected graph, a spanning tree t is a subgraph of g, where t: Is connected - make it a tree. Is acyclic - make it a tree. Includes all of the vertices - makes it spanning. A minimum spanning tree is a spanning tree of minimum total weight. A shortest paths tree depends on the start vertex. Because it tells you how to get from a source to everything. But the mst sometimes happens to be an spt for a specific vertex.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents