COMPSCI 61B Study Guide - Final Guide: Insertion Sort, Preorder, Subsequence

83 views17 pages
10 May 2018
School
Professor
Final
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 17 pages and 3 million more documents.

Already have an account? Log in
Wed 3121 :27
.Graphs
Graphs :aset of nodes connected pair Wise by edges
vertices
Directed Undirected With Edge Labels
Aoydio 0¥20 aO0g5@@ @iQ-O
¥
µ
Cyclic @tQy@ @¥
\←
degree :avertex has adegree :# edges touching it
edge :bhietwheen 2nods
adjacent :node with an edge in between
path no
cyde.rs first &last are the same .Basically if you reach any repeat thankyou
cyclic :graph that has at least one cycle
Connected :nods with path in between
tree :graph with no cycles
Dstore agraph &its edges v2 2.) Store agraph list of edjes
Vi {of all Combinations }
Amdtaasm
.ge?fjD#taKtokmueekotomen
W@→@
Target
can do this for directed &non directed
3.) MOST popular every few edges then OCV )worst case :many edges =V2 OCVD
*
ftp.#gIgIgI
§
:C Vt '⇒ Best . .OCD wors OCH therefore at E) is agood way ot
best :E=o( F) v+r✓=✓ writing that
worst OCVD VtV2=v2
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 17 pages and 3 million more documents.

Already have an account? Log in
Traversing
:Dept##rstsearoh
as dfs is called
boolean marked Dwhich Ones have been passed over
eedgeto .
.away into :change each node to its Parent
has Path :checked if marked !
easy
runtime :O CVt E)
every edge used once
#v=#edges
.dfs is called Changes marked ,edgeto for one child .When leaf returns back up till
there was achild that dad hasn't been called on
each edge is used
.Runtime :ON +E) :each vertex is visited once .each visit costs constant time
.Space :OCD :stack depth is V
°Implementation
opassin Graph &starting Node to paths Class 's constructor which
does all the work understands graph (boo lean marked )
.has Pathto Cint D:returns marked kind ](edgetof ]stones the parent
pathto (Dreturns iterabhe .at the child $nods
spot
when you reath marked go up
till theres another unmarked
child
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 17 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Graphs a set of nodes vertices connected pair. @iq-o degree : a vertex has a degree :# edges touching it. 2 with nods node adjacent an edge in path no edge : bhietwheen. : graph repeat cyclic any reach you between cycle nods same between with the least has that are one if at path in tree : graph with no cycles. D store a graph & its edges v2. Best worst this then few that can case do for is. Vtv2=v2 as dfs is called node to been passed its parent over. Ones have away into : change each has path : checked if marked runtime. :dept##rstsearoh every edge used easy v once edges dfs is called. When leaf returns back up till there was a child that dad hasn"t been called on each edge is used. Runtime : on + e) each vertex is visited once . each visit costs constant time.

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

Related Documents