COMP 250 Lecture Notes - Lecture 27: Adjacency List, Hash Table

8 views7 pages

Document Summary

You have some network of rads which you want to use to get to some location -- type start and finish. In comp 251, you"ll learn the shortest path traversal. Today, we go through basic mechanics of starting at one node, and visiting other ones, via paths. Today"s algorithms are very similar to the ones we did in trees. So in a sense, we"ve already covered this, just need to tweak it a bit more; graphs are more general than trees. Tree traversal (preorder) depthfirst__tree (root){ v. visited = true if(root is not empty){ visit root. Check to see if there is anything in the root. Note that the visiting of the root doesn"t do anything, in terms of the order in which we reach the nodes. If you put the line somewhere else, you still follow the links in the exact same way. We will try to reach all the vertices we can through paths, starting from a.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents