{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

02 - Algorithms Greedy Algorithms Greedy Algorithms Design...

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

View Full Document Right Arrow Icon
Algorithms – Greedy Algorithms Greedy Algorithms Design and Analysis of Algorithms Andrei Bulatov
Image of page 1

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

View Full Document Right Arrow Icon
“Greed … is good. Greed is right. Greed works.” “Wall Street” Algorithms – Greedy Algorithms 2-2 -2
Image of page 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
Image of page 3

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

View Full Document Right Arrow Icon
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
Image of page 4
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]
Image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern