Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS200: Algorithm Analysis

Similar presentations


Presentation on theme: "CS200: Algorithm Analysis"— Presentation transcript:

1 CS200: Algorithm Analysis

2 GREEDY ALGORITHMS Used for optimization problems. Sometimes it is possible to make a locally optimal choice that leads to a globally optimal solution, without the use of dynamic programming. Greedy algorithms do just that, and are attractive because they are more efficient than dynamic programming techniques. The first greedy algorithm examined deals with graphs so a brief graph discussion is provided next.

3 GRAPHS

4 Graph Types Undirected Graphs Weighted undirected graph

5 Running times for graph algorithms; expressed in terms of |V| and |E|.
If |E| is  |V2| then the graph is dense. If |E| is  |V| then the graph is sparse.

6 GRAPH REPRESENTATIONS

7 Adjacency Matrix Representation

8 Matrix Example 2

9 Matrix representation requires too much storage for large graphs that are sparse, but very efficient for small graphs: use 1 bit per edge.

10 Adjacency List Representation

11 List Example 2

12 Adjacency List Representation

13 Vertex Degree/Indegree/Outdegree
What is the degree of vertex a? of vertex c? What is the indegree of vertex 0 ? Vertex 2 ? What is the outdegree of vertex 3? Vertex 1?

14 Adjacency List Representation


Download ppt "CS200: Algorithm Analysis"

Similar presentations


Ads by Google