








































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









































Implementation: more difficult than it seems^ y^ The Challenge of Binary Search - it tookmore than 10 years to publish the firstcorrect binary search^ y^ Graph algorithms are notoriously difficultto test for correctness
Given a list of cities and their pair-wise distances,find a shortest possible tour that visits each cityexactly once.
Clearly a network problem. One of the most intensively studied problems in
optimization
k^ )^ k = constant Traveling salesman: O(N!)15!/5! = 10 billionMany others are unknown Luckily problems can often be greatly simplified
c^ d^ e
f^ g^
h
a^0
0 0
1 0 1
0
b^1
1 0
0 0 0
1
c^0
0 1
0 1 1
0
d^0
1 0
1 0 0
0
e^1
0 1
0 0 0
0
f^0
1 0
0 0 1
0
g^1
1 0
0 0 0
0
h^0
0 0
0 0 0
0
E - number of edges matrix list^
edge array
space^
find edge^
insert edge^
path^ v^ to^ w?
E lgV
Which two graphs are identical?
Vertex^
Pre^ Posta 1
b^
c^
d^
e^
f^
g^
h^
y^ edges corresponding to recursive calls (tree edges)^ {^ tree link
if w^ has not been visited {^ parent link
if during the traversal we went from
v^ to^ w
y^ edges connecting a vertex with an ancestor that is not aparent^ {^ back link
if^ pre[w] < pre[v] {^ down link
if^ pre[w] > pre[v]