{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 02 - Algorithms Greedy Algorithms Greedy Algorithms Design...

This preview shows pages 1–6. Sign up to view the full content.

Algorithms – Greedy Algorithms Greedy Algorithms Design and Analysis of Algorithms Andrei Bulatov

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
“Greed … is good. Greed is right. Greed works.” “Wall Street” Algorithms – Greedy Algorithms 2-2 -2
Algorithms – Greedy Algorithms 2-3 Graph Reminder Vertices and edges Nodes and arcs Representation of graphs: -- adjacency matrix -- adjacency lists Degrees of vertices, indegree, outdegree; regular graphs Handshaking Lemma Walks, paths, and cycles; lengths Connectivity, connected components Bipartite graphs; characterization of bipartite graphs Euler and Hamilton graphs Trees, root, leaves, parent and child, descendant and ancestor Acyclic digraphs

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Algorithms – Greedy Algorithms 2-4 Graph Traversing: BFS Breadth First Search(s) Input : a graph G=(V,E) and s V Output : the connected component containing s set Discov[s]:=true and Discov[v]:=false for v s set L[0] to consist of the single element s; i:=0 while L[i] is not empty do set L[i+1] to be an empty list for u L[i] do for each (u,v) E do if Discov[v]=false then set Discov[v]:=true; add v to L[i+1] endfor endfor set i:=i+1 endwhile
Algorithms – Greedy Algorithms 2-5 BFS Tree s t u w v x s t u w v x L[0] L[1] L[2] L[3]

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern