COMPSCI 61B Lecture Notes - Lecture 25: Directed Graph, Subroutine, Linked List

22 views9 pages
16 Apr 2019
School
Professor

Document Summary

Efficient algorithms can improve the performance of code, solve problems that are otherwise intractable. Shows an understanding of how computers work; understand computing. Provides a common platform for interviewing for technical knowledge. You now have a huge toolset you can use to solve problems. Multiple breadth-first searches from vertices of in-degree 0. But not good if we have a new node that points to 7 directly. Go as far as you can get (dfs) Solution: perform a dfs traversal from every vertex with indegree 0, not clearing markings in between traversals. Topological ordering is given by the reverse of that list (reverse postorder) Topological ordering: [2, 5, 6, 0, 3, 1, 4, 7] Can think of this process as sorting our nodes so that they appear in an order consistent with edges. When nodes are sorted in diagram, arrows all point rightwards.

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