Lecture 6 Basic Graph Algorithms

Size: px
Start display at page:

Download "Lecture 6 Basic Graph Algorithms"

Transcription

1 CS 491 CAP Intro to Competitive Algorithmic Programming Lecture 6 Basic Graph Algorithms Uttam Thakore University of Illinois at Urbana-Champaign September 30, 2015

2 Updates ICPC Regionals teams will be announced by early next week If you have a team preference, please let me know by by the weekend CS 491 CAP Intro to Competitive Algorithmic Programming 2

3 Outline Minimum Spanning Tree Kruskal s Algorithm Disjoint Set Data Structure Prim s Algorithm Shortest Path Dijkstra s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Strongly Connected Components Tarjan s Algorithm CS 491 CAP Intro to Competitive Algorithmic Programming 3

4 Minimum Spanning Tree CS 491 CAP Intro to Competitive Algorithmic Programming 4

5 Problem Definition Given a weighted, undirected graph: G = V, E Find a subset of E that connects all vertices in V into a tree (i.e., no cycles) with the minimum total edge weight Figure taken from Wikipedia CS 491 CAP Intro to Competitive Algorithmic Programming 5

6 Definitions: Cut: Any partition of a graph G into two sets S and T Notation: C = (S, T) Cut-set: All edges that have one endpoint in S and the other in T Also the edges that must be deleted to partition the graph S T S = {A, B, D, E} T = {C, F} Cut-set in red G Figure taken from Wikipedia CS 491 CAP Intro to Competitive Algorithmic Programming 6

7 Cut Property of MSTs For any cut C of a graph, if e is the unique minimum weight edge in the cut-set of C, then e belongs to all MSTs of the graph Proof: Consider a MST T Assume by contradiction that e is not in T There must exist another edge e T from S to V S, which has weight at least as large as e Adding e and removing e results in a spanning tree T that is at least as good as T Since T is an MST, T must also be an MST So e is part of some MST! CS 491 CAP Intro to Competitive Algorithmic Programming 7

8 Minimum-cost Edge Property of MSTs If there is a unique minimum cost edge e of a graph, it must belong to all MSTs of the graph Proof: Assume e was not included in the MST Then adding e would create a cycle Removing any of the edges e in the cycle formed would yield an MST of smaller weight Thus, e must be in the MST! G Figure taken from Wikipedia CS 491 CAP Intro to Competitive Algorithmic Programming 8

9 Kruskal s Algorithm Cut property implies: The edge with the smallest weight is in an MST Each edge with subsequently larger weight is also part of the MST, provided that it doesn t create a cycle This is Kruskal s algorithm! CS 491 CAP Intro to Competitive Algorithmic Programming 9

10 Kruskal s Algorithm Pseudocode: Sort the edges in increasing order of weight Iterate through each edge e in order, until size of the MST = V 1 If e connects two different connected components, then add e to the MST and merge the two connected components (using disjoint set data structure) Otherwise, ignore e and move on Runtime complexity: O( E log V ) (because of sorting) CS 491 CAP Intro to Competitive Algorithmic Programming 10

11 Kruskal s Algorithm: Illustration Figure taken from Wikipedia CS 491 CAP Intro to Competitive Algorithmic Programming 11

12 Kruskal s Algorithm: Illustration Figure taken from Wikipedia CS 491 CAP Intro to Competitive Algorithmic Programming 12

13 Kruskal s Algorithm: Illustration Figure taken from Wikipedia CS 491 CAP Intro to Competitive Algorithmic Programming 13

14 Kruskal s Algorithm: Illustration Figure taken from Wikipedia CS 491 CAP Intro to Competitive Algorithmic Programming 14

15 Kruskal s Algorithm: Illustration Figure taken from Wikipedia CS 491 CAP Intro to Competitive Algorithmic Programming 15

16 Kruskal s Algorithm: Illustration Figure taken from Wikipedia CS 491 CAP Intro to Competitive Algorithmic Programming 16

17 Disjoint Set Data Structure Also called Union-Find data structure Given a set of items, want a data structure that supports three operations: Create a singleton set from an item Merge two sets into a single set (union operation) Given an item, determine which set it belongs to (find operation) In our context, want to be able to merge two MSTs and find whether a new edge connects two MSTs CS 491 CAP Intro to Competitive Algorithmic Programming 17

18 Disjoint Set Data Structure Each group will form a rooted tree structure Maintain a vector P[v], which stores the parent of v Initially P v 1 to indicate that each node is a root by itself Find(u): Finds the root of the group that u belongs to If P u = 1: return u return Find(P[u]) Union(u, v): (merge two groups that u and v belong to) u Find u, v Find(v) If u = v : return (two items belong to the same group, no merge needed) Otherwise, set P[u ] v (basically attach one tree to the other tree) CS 491 CAP Intro to Competitive Algorithmic Programming 18

19 Disjoint Set Data Structure Problem? Can be too slow! The Union operations can, in the worst case, create a tree with depth linear in the number of items This in turn can make Find operation very slow Two heuristics to take care of this issue: Union by rank Attach the tree with smaller height to the root of another tree in Union operation Path compression Whenever Find is called, for each item visited along the way to the root, directly attach the item to the root) These two heuristics make the operations constant (practically) CS 491 CAP Intro to Competitive Algorithmic Programming 19

20 Kruskal & Disjoint Set DS Checking if an edge connects two different connected components can be done with Find operation in ~O(1) Merging two connected components as a single connected component can be done with Union operation in O(1) So the part after sorting is effectively O( E ) CS 491 CAP Intro to Competitive Algorithmic Programming 20

21 Prim s Algorithm Maintain a set S that starts out with a single node Find the smallest weighted edge e = (u, v) in the cut-set for C = (S, V S) Add e to the MST and add v to S Repeat until S = V Difference from Kruskal s: Instead of growing multiple sets, we grow a single supernode S CS 491 CAP Intro to Competitive Algorithmic Programming 21

22 Prim s Algorithm: Illustration Figure from B403/LectureNotes/09-mst.html CS 491 CAP Intro to Competitive Algorithmic Programming 22

23 Prim s Algorithm: Illustration Figure from B403/LectureNotes/09-mst.html CS 491 CAP Intro to Competitive Algorithmic Programming 23

24 Prim s Algorithm: Illustration Figure from B403/LectureNotes/09-mst.html CS 491 CAP Intro to Competitive Algorithmic Programming 24

25 Prim s Algorithm: Illustration Figure from B403/LectureNotes/09-mst.html CS 491 CAP Intro to Competitive Algorithmic Programming 25

26 Prim s Algorithm: Illustration Figure from B403/LectureNotes/09-mst.html CS 491 CAP Intro to Competitive Algorithmic Programming 26

27 Prim s Algorithm: Illustration Figure from B403/LectureNotes/09-mst.html CS 491 CAP Intro to Competitive Algorithmic Programming 27

28 Prim s Algorithm: Illustration Figure from B403/LectureNotes/09-mst.html CS 491 CAP Intro to Competitive Algorithmic Programming 28

29 Prim s Algorithm: Illustration Figure from B403/LectureNotes/09-mst.html CS 491 CAP Intro to Competitive Algorithmic Programming 29

30 Prim s Algorithm: Illustration Figure from B403/LectureNotes/09-mst.html CS 491 CAP Intro to Competitive Algorithmic Programming 30

31 Prim s Algorithm Initialize S {s}, D[v] weight(e(s, v)) for every v. If e(s, v) E, D[v] Repeat until S = V: Find v S with smallest D[v] Use linear search, or use priority queue for better performance Add v to S, add D[v] to the total weight of the MST For each edge neighboring edges of v, e(v, w) Update D[w] min(d[w] weight(v, w)) Runtime complexity: O( E log V ) CS 491 CAP Intro to Competitive Algorithmic Programming 31

32 Shortest Path CS 491 CAP Intro to Competitive Algorithmic Programming 32

33 Problem Definition Given a (undirected or directed) weighted graph G = V, E, find a path between two given nodes u and v that minimizes the total weight of the path Sometimes the edge weights can be negative Sometimes we want to compute shortest paths from u to all other nodes Sometimes we want to compute all-pair shortest paths CS 491 CAP Intro to Competitive Algorithmic Programming 33

34 Dijkstra s Algorithm Can solve simplest form: Single-Source Shortest Path (SSSP) with no negative weights Greedy algorithm Works very similarly to Prim s Algorithm CS 491 CAP Intro to Competitive Algorithmic Programming 34

35 Dijkstra s Algorithm Pseudocode: Maintain a set S that stores nodes for which the shortest path has already been determined Maintain a vector D[v] to store the shortest distance estimate from s Initially, S s, D[v] weight(s, v) If e(s, v) E, D[v] Repeat until S = V Find v S with the smallest D[v], and add it to S Use priority queue for better performance For each edge v u with weight w, D[u] min(d[u], D[v] + w) Note: If you are asked to find the actual sequence of nodes in the path, store that in D[v] in addition to the distance Running time: O( E log V ) CS 491 CAP Intro to Competitive Algorithmic Programming 35

36 Dijkstra s Algorithm: Illustration Figure from B403/LectureNotes/10-graphalgo.html CS 491 CAP Intro to Competitive Algorithmic Programming 36

37 Dijkstra s Algorithm: Illustration Figure from B403/LectureNotes/10-graphalgo.html CS 491 CAP Intro to Competitive Algorithmic Programming 37

38 Dijkstra s Algorithm: Illustration Figure from B403/LectureNotes/10-graphalgo.html CS 491 CAP Intro to Competitive Algorithmic Programming 38

39 Dijkstra s Algorithm: Illustration Figure from B403/LectureNotes/10-graphalgo.html CS 491 CAP Intro to Competitive Algorithmic Programming 39

40 Dijkstra s Algorithm: Illustration Figure from B403/LectureNotes/10-graphalgo.html CS 491 CAP Intro to Competitive Algorithmic Programming 40

41 Dijkstra s Algorithm: Illustration Figure from B403/LectureNotes/10-graphalgo.html CS 491 CAP Intro to Competitive Algorithmic Programming 41

42 Bellman-Ford Algorithm Unlike Dijkstra s, can handle negative edge weights Can detect negative-weight cycles Very easy to code CS 491 CAP Intro to Competitive Algorithmic Programming 42

43 Bellman-Ford Algorithm Initialize D[s] 0 and D[v] for all v s For k = 1.. V 1: For each edge u v of weight w: D v min(d[v], D[u] + w) For each edge u v of weight w: If D v > D u + w: The graph contains a negative weight cycle Runtime complexity: O( E V ) CS 491 CAP Intro to Competitive Algorithmic Programming 43

44 Bellman-Ford Algorithm Why does it work? A shortest path can have at most V 1 edges Any longer path must contain a cycle At the kth iteration, all shortest paths using k or less edges are computed After V 1 iterations, all distances must be final That is, for every edge u v of weight w, D v D[u] + w holds Unless there is a negative weight cycle This is how negative weight cycle detection works CS 491 CAP Intro to Competitive Algorithmic Programming 44

45 Floyd-Warshall Algorithm Computes All-Pairs Shortest Paths (APSP) Like Bellman-Ford, can handle negative edge weights Store answers in table D[i][j] D[i][j] stores the total weight of the shortest path from vertex i to j VERY easy to code: only 4 lines! CS 491 CAP Intro to Competitive Algorithmic Programming 45

46 Floyd-Warshall Algorithm Pseudocode: Initialize matrix D with weights from the given graph ( if there is no edge) for k = 1.. V: for i = 1.. V: for j = 1.. V: D[i][j] min(d i j, D[i][k] + D[k][j]) Runtime complexity: O( V 3 ) CS 491 CAP Intro to Competitive Algorithmic Programming 46

47 Floyd-Warshall Algorithm Why does it work? Dynamic Programming D[k][i][j]: weight of shortest path from i to j using vertices numbered k as the intermediate nodes The recurrence relation then is D[k][i][j] = min(d[k 1][i][j], D[k 1][i][k] + D[k 1][k][j]) This holds because we have two possible choices: either use k as the intermediate node, or don t Turns out the first dimension is not necessary, can just overwrite Can be extended to find the actual shortest path sequence: see link CS 491 CAP Intro to Competitive Algorithmic Programming 47

48 Strongly Connected Components CS 491 CAP Intro to Competitive Algorithmic Programming 48

49 Problem Definition A directed graph is strongly connected if there is a path between each pair of vertices in the graph Given a directed graph G = V, E, partition the graph into subgraphs (components) that are each maximally strongly connected Maximal: no additional edges or vertices from G can be included in the subgraph without breaking the strongly connected property Figure taken from Wikipedia CS 491 CAP Intro to Competitive Algorithmic Programming 49

50 Algorithms Commonly used algorithms: Kosaraju s Algorithm Tarjan s Algorithm Both algorithms use DFS to traverse the graph and determine whether a set of nodes forms a strongly connected component CS 491 CAP Intro to Competitive Algorithmic Programming 50

51 Kosaraju s Algorithm Intuition: If a set of nodes is part of an SCC traversing the graph in one direction, it should be part of the same SCC traversing in the reverse direction Pseudocode: Mark all nodes as unvisited and initialize a stack S For each vertex u of the graph, perform Visit(u) For each element of S (popping fro the stack), perform Assign(u, u) Visit(u): If u is unvisited: Mark u as visited For each edge u v, Visit(v) Push u to the top of stack S Assign(u, root): If u has not been assigned to a component: Assign u to the component root For each edge u v, Assign(v, root) CS 491 CAP Intro to Competitive Algorithmic Programming 51

52 Kosaraju s Algorithm Runtime complexity: O( V + E ) Uses two DFSes one in the forward direction, and one in the reverse direction Can also be implemented using BFS CS 491 CAP Intro to Competitive Algorithmic Programming 52

53 Tarjan s Algorithm Can we do this in one DFS? Yes! This is Tarjan s Algorithm See the Competitive Programming book for details CS 491 CAP Intro to Competitive Algorithmic Programming 53

54 Questions? CS 491 CAP Intro to Competitive Algorithmic Programming 54

CS 310 Advanced Data Structures and Algorithms

CS 310 Advanced Data Structures and Algorithms CS 0 Advanced Data Structures and Algorithms Weighted Graphs July 0, 07 Tong Wang UMass Boston CS 0 July 0, 07 / Weighted Graphs Each edge has a weight (cost) Edge-weighted graphs Mostly we consider only

More information

Outline. Graphs. Divide and Conquer.

Outline. Graphs. Divide and Conquer. GRAPHS COMP 321 McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park slides CS 97SI - Top-coder tutorials. - Programming Challenges books. Outline Graphs.

More information

Part VI Graph algorithms. Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths

Part VI Graph algorithms. Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths Part VI Graph algorithms Chapter 22 Elementary Graph Algorithms Chapter 23 Minimum Spanning Trees Chapter 24 Single-source Shortest Paths 1 Chapter 22 Elementary Graph Algorithms Representations of graphs

More information

Parallel Graph Algorithms

Parallel Graph Algorithms Parallel Graph Algorithms Design and Analysis of Parallel Algorithms 5DV050/VT3 Part I Introduction Overview Graphs definitions & representations Minimal Spanning Tree (MST) Prim s algorithm Single Source

More information

CIS 121 Data Structures and Algorithms Minimum Spanning Trees

CIS 121 Data Structures and Algorithms Minimum Spanning Trees CIS 121 Data Structures and Algorithms Minimum Spanning Trees March 19, 2019 Introduction and Background Consider a very natural problem: we are given a set of locations V = {v 1, v 2,..., v n }. We want

More information

CS521 \ Notes for the Final Exam

CS521 \ Notes for the Final Exam CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )

More information

CHAPTER 13 GRAPH ALGORITHMS

CHAPTER 13 GRAPH ALGORITHMS CHAPTER 13 GRAPH ALGORITHMS SFO LAX ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND MOUNT (WILEY 00) AND SLIDES FROM NANCY

More information

Chapter 23. Minimum Spanning Trees

Chapter 23. Minimum Spanning Trees Chapter 23. Minimum Spanning Trees We are given a connected, weighted, undirected graph G = (V,E;w), where each edge (u,v) E has a non-negative weight (often called length) w(u,v). The Minimum Spanning

More information

Shortest path problems

Shortest path problems Next... Shortest path problems Single-source shortest paths in weighted graphs Shortest-Path Problems Properties of Shortest Paths, Relaxation Dijkstra s Algorithm Bellman-Ford Algorithm Shortest-Paths

More information

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019

CS 341: Algorithms. Douglas R. Stinson. David R. Cheriton School of Computer Science University of Waterloo. February 26, 2019 CS 341: Algorithms Douglas R. Stinson David R. Cheriton School of Computer Science University of Waterloo February 26, 2019 D.R. Stinson (SCS) CS 341 February 26, 2019 1 / 296 1 Course Information 2 Introduction

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spanning Trees Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and no

More information

CS200: Graphs. Rosen Ch , 9.6, Walls and Mirrors Ch. 14

CS200: Graphs. Rosen Ch , 9.6, Walls and Mirrors Ch. 14 CS200: Graphs Rosen Ch. 9.1-9.4, 9.6, 10.4-10.5 Walls and Mirrors Ch. 14 Trees as Graphs Tree: an undirected connected graph that has no cycles. A B C D E F G H I J K L M N O P Rooted Trees A rooted tree

More information

Taking Stock. Last Time Flows. This Time Review! 1 Characterize the structure of an optimal solution

Taking Stock. Last Time Flows. This Time Review! 1 Characterize the structure of an optimal solution Taking Stock IE170: Algorithms in Systems Engineering: Lecture 26 Jeff Linderoth Last Time Department of Industrial and Systems Engineering Lehigh University April 2, 2007 This Time Review! Jeff Linderoth

More information

Parallel Graph Algorithms

Parallel Graph Algorithms Parallel Graph Algorithms Design and Analysis of Parallel Algorithms 5DV050 Spring 202 Part I Introduction Overview Graphsdenitions, properties, representation Minimal spanning tree Prim's algorithm Shortest

More information

managing an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm

managing an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm Spanning Trees 1 Spanning Trees the minimum spanning tree problem three greedy algorithms analysis of the algorithms 2 The Union-Find Data Structure managing an evolving set of connected components implementing

More information

Review of course COMP-251B winter 2010

Review of course COMP-251B winter 2010 Review of course COMP-251B winter 2010 Lecture 1. Book Section 15.2 : Chained matrix product Matrix product is associative Computing all possible ways of parenthesizing Recursive solution Worst-case running-time

More information

Lecture 11: Analysis of Algorithms (CS ) 1

Lecture 11: Analysis of Algorithms (CS ) 1 Lecture 11: Analysis of Algorithms (CS583-002) 1 Amarda Shehu November 12, 2014 1 Some material adapted from Kevin Wayne s Algorithm Class @ Princeton 1 2 Dynamic Programming Approach Floyd-Warshall Shortest

More information

Single Source Shortest Path (SSSP) Problem

Single Source Shortest Path (SSSP) Problem Single Source Shortest Path (SSSP) Problem Single Source Shortest Path Problem Input: A directed graph G = (V, E); an edge weight function w : E R, and a start vertex s V. Find: for each vertex u V, δ(s,

More information

Graphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs

Graphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs Graphs and Network Flows ISE 411 Lecture 7 Dr. Ted Ralphs ISE 411 Lecture 7 1 References for Today s Lecture Required reading Chapter 20 References AMO Chapter 13 CLRS Chapter 23 ISE 411 Lecture 7 2 Minimum

More information

Agenda. Graph Representation DFS BFS Dijkstra A* Search Bellman-Ford Floyd-Warshall Iterative? Non-iterative? MST Flow Edmond-Karp

Agenda. Graph Representation DFS BFS Dijkstra A* Search Bellman-Ford Floyd-Warshall Iterative? Non-iterative? MST Flow Edmond-Karp Graph Charles Lin genda Graph Representation FS BFS ijkstra * Search Bellman-Ford Floyd-Warshall Iterative? Non-iterative? MST Flow Edmond-Karp Graph Representation djacency Matrix bool way[100][100];

More information

Week 12: Minimum Spanning trees and Shortest Paths

Week 12: Minimum Spanning trees and Shortest Paths Agenda: Week 12: Minimum Spanning trees and Shortest Paths Kruskal s Algorithm Single-source shortest paths Dijkstra s algorithm for non-negatively weighted case Reading: Textbook : 61-7, 80-87, 9-601

More information

Graph Algorithms (part 3 of CSC 282),

Graph Algorithms (part 3 of CSC 282), Graph Algorithms (part of CSC 8), http://www.cs.rochester.edu/~stefanko/teaching/10cs8 1 Schedule Homework is due Thursday, Oct 1. The QUIZ will be on Tuesday, Oct. 6. List of algorithms covered in the

More information

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI. Department of Computer Science and Engineering CS6301 PROGRAMMING DATA STRUCTURES II

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI. Department of Computer Science and Engineering CS6301 PROGRAMMING DATA STRUCTURES II DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI Department of Computer Science and Engineering CS6301 PROGRAMMING DATA STRUCTURES II Anna University 2 & 16 Mark Questions & Answers Year / Semester: II / III

More information

Tutorial. Question There are no forward edges. 4. For each back edge u, v, we have 0 d[v] d[u].

Tutorial. Question There are no forward edges. 4. For each back edge u, v, we have 0 d[v] d[u]. Tutorial Question 1 A depth-first forest classifies the edges of a graph into tree, back, forward, and cross edges. A breadth-first tree can also be used to classify the edges reachable from the source

More information

from notes written mostly by Dr. Carla Savage: All Rights Reserved

from notes written mostly by Dr. Carla Savage: All Rights Reserved CSC 505, Fall 2000: Week 9 Objectives: learn about various issues related to finding shortest paths in graphs learn algorithms for the single-source shortest-path problem observe the relationship among

More information

Lecture 4: Graph Algorithms

Lecture 4: Graph Algorithms Lecture 4: Graph Algorithms Definitions Undirected graph: G =(V, E) V finite set of vertices, E finite set of edges any edge e = (u,v) is an unordered pair Directed graph: edges are ordered pairs If e

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Shortest Path Problem G. Guérard Department of Nouvelles Energies Ecole Supérieur d Ingénieurs Léonard de Vinci Lecture 3 GG A.I. 1/42 Outline 1 The Shortest Path Problem Introduction

More information

Week 11: Minimum Spanning trees

Week 11: Minimum Spanning trees Week 11: Minimum Spanning trees Agenda: Minimum Spanning Trees Prim s Algorithm Reading: Textbook : 61-7 1 Week 11: Minimum Spanning trees Minimum spanning tree (MST) problem: Input: edge-weighted (simple,

More information

2 A Template for Minimum Spanning Tree Algorithms

2 A Template for Minimum Spanning Tree Algorithms CS, Lecture 5 Minimum Spanning Trees Scribe: Logan Short (05), William Chen (0), Mary Wootters (0) Date: May, 0 Introduction Today we will continue our discussion of greedy algorithms, specifically in

More information

Minimum spanning trees

Minimum spanning trees Minimum spanning trees [We re following the book very closely.] One of the most famous greedy algorithms (actually rather family of greedy algorithms). Given undirected graph G = (V, E), connected Weight

More information

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree Algorithms and Theory of Computation Lecture 5: Minimum Spanning Tree Xiaohui Bei MAS 714 August 31, 2017 Nanyang Technological University MAS 714 August 31, 2017 1 / 30 Minimum Spanning Trees (MST) A

More information

CS350: Data Structures Dijkstra s Shortest Path Alg.

CS350: Data Structures Dijkstra s Shortest Path Alg. Dijkstra s Shortest Path Alg. James Moscola Department of Engineering & Computer Science York College of Pennsylvania James Moscola Shortest Path Algorithms Several different shortest path algorithms exist

More information

Introduction to Algorithms. Lecture 11

Introduction to Algorithms. Lecture 11 Introduction to Algorithms Lecture 11 Last Time Optimization Problems Greedy Algorithms Graph Representation & Algorithms Minimum Spanning Tree Prim s Algorithm Kruskal s Algorithm 2 Today s Topics Shortest

More information

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree

Algorithms and Theory of Computation. Lecture 5: Minimum Spanning Tree Algorithms and Theory of Computation Lecture 5: Minimum Spanning Tree Xiaohui Bei MAS 714 August 31, 2017 Nanyang Technological University MAS 714 August 31, 2017 1 / 30 Minimum Spanning Trees (MST) A

More information

Greedy Algorithms Part Three

Greedy Algorithms Part Three Greedy Algorithms Part Three Announcements Problem Set Four due right now. Due on Wednesday with a late day. Problem Set Five out, due Monday, August 5. Explore greedy algorithms, exchange arguments, greedy

More information

CSE 100: GRAPH ALGORITHMS

CSE 100: GRAPH ALGORITHMS CSE 100: GRAPH ALGORITHMS Dijkstra s Algorithm: Questions Initialize the graph: Give all vertices a dist of INFINITY, set all done flags to false Start at s; give s dist = 0 and set prev field to -1 Enqueue

More information

Graph Representation DFS BFS Dijkstra A* Search Bellman-Ford Floyd-Warshall Iterative? Non-iterative? MST Flow Edmond-Karp

Graph Representation DFS BFS Dijkstra A* Search Bellman-Ford Floyd-Warshall Iterative? Non-iterative? MST Flow Edmond-Karp Charles Lin Graph Representation DFS BFS Dijkstra A* Search Bellman-Ford Floyd-Warshall Iterative? Non-iterative? MST Flow Edmond-Karp Adjacency Matrix bool way[100][100]; cin >> i >> j; way[i][j] = true;

More information

All Shortest Paths. Questions from exercises and exams

All Shortest Paths. Questions from exercises and exams All Shortest Paths Questions from exercises and exams The Problem: G = (V, E, w) is a weighted directed graph. We want to find the shortest path between any pair of vertices in G. Example: find the distance

More information

Algorithm Design (8) Graph Algorithms 1/2

Algorithm Design (8) Graph Algorithms 1/2 Graph Algorithm Design (8) Graph Algorithms / Graph:, : A finite set of vertices (or nodes) : A finite set of edges (or arcs or branches) each of which connect two vertices Takashi Chikayama School of

More information

Spanning Trees 4/19/17. Prelim 2, assignments. Undirected trees

Spanning Trees 4/19/17. Prelim 2, assignments. Undirected trees /9/7 Prelim, assignments Prelim is Tuesday. See the course webpage for details. Scope: up to but not including today s lecture. See the review guide for details. Deadline for submitting conflicts has passed.

More information

Spanning Trees. Lecture 22 CS2110 Spring 2017

Spanning Trees. Lecture 22 CS2110 Spring 2017 1 Spanning Trees Lecture 22 CS2110 Spring 2017 1 Prelim 2, assignments Prelim 2 is Tuesday. See the course webpage for details. Scope: up to but not including today s lecture. See the review guide for

More information

Graph Algorithms shortest paths, minimum spanning trees, etc.

Graph Algorithms shortest paths, minimum spanning trees, etc. Graph Algorithms shortest paths, minimum spanning trees, etc. SFO ORD LAX DFW Graphs 1 Outline and Reading Graphs ( 1.1) Definition Applications Terminology Properties ADT Data structures for graphs (

More information

10/31/18. About A6, Prelim 2. Spanning Trees, greedy algorithms. Facts about trees. Undirected trees

10/31/18. About A6, Prelim 2. Spanning Trees, greedy algorithms. Facts about trees. Undirected trees //8 About A, Prelim Spanning Trees, greedy algorithms Lecture CS Fall 8 Prelim : Thursday, November. Visit exams page of course website and read carefully to find out when you take it (: or 7:) and what

More information

Spanning Trees, greedy algorithms. Lecture 20 CS2110 Fall 2018

Spanning Trees, greedy algorithms. Lecture 20 CS2110 Fall 2018 1 Spanning Trees, greedy algorithms Lecture 20 CS2110 Fall 2018 1 About A6, Prelim 2 Prelim 2: Thursday, 15 November. Visit exams page of course website and read carefully to find out when you take it

More information

Spanning Trees, greedy algorithms. Lecture 22 CS2110 Fall 2017

Spanning Trees, greedy algorithms. Lecture 22 CS2110 Fall 2017 1 Spanning Trees, greedy algorithms Lecture 22 CS2110 Fall 2017 1 We demo A8 Your space ship is on earth, and you hear a distress signal from a distance Planet X. Your job: 1. Rescue stage: Fly your ship

More information

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29 Lecture 13 Connectedness in graphs Spanning trees in graphs Finding a minimal spanning tree Time costs of graph problems and NP-completeness Finding a minimal spanning tree: Prim s and Kruskal s algorithms

More information

Homework Assignment #3 Graph

Homework Assignment #3 Graph CISC 4080 Computer Algorithms Spring, 2019 Homework Assignment #3 Graph Some of the problems are adapted from problems in the book Introduction to Algorithms by Cormen, Leiserson and Rivest, and some are

More information

looking ahead to see the optimum

looking ahead to see the optimum ! Make choice based on immediate rewards rather than looking ahead to see the optimum! In many cases this is effective as the look ahead variation can require exponential time as the number of possible

More information

Introduction to Parallel & Distributed Computing Parallel Graph Algorithms

Introduction to Parallel & Distributed Computing Parallel Graph Algorithms Introduction to Parallel & Distributed Computing Parallel Graph Algorithms Lecture 16, Spring 2014 Instructor: 罗国杰 gluo@pku.edu.cn In This Lecture Parallel formulations of some important and fundamental

More information

Advanced Algorithm Design and Analysis (Lecture 5) SW5 fall 2007 Simonas Šaltenis

Advanced Algorithm Design and Analysis (Lecture 5) SW5 fall 2007 Simonas Šaltenis Advanced Algorithm Design and Analysis (Lecture 5) SW5 fall 2007 Simonas Šaltenis 3.2.12 simas@cs.aau.dk All-pairs shortest paths Main goals of the lecture: to go through one more example of dynamic programming

More information

UNIT 5 GRAPH. Application of Graph Structure in real world:- Graph Terminologies:

UNIT 5 GRAPH. Application of Graph Structure in real world:- Graph Terminologies: UNIT 5 CSE 103 - Unit V- Graph GRAPH Graph is another important non-linear data structure. In tree Structure, there is a hierarchical relationship between, parent and children that is one-to-many relationship.

More information

CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Dan Grossman Fall 2013

CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Dan Grossman Fall 2013 CSE373: Data Structures & Algorithms Lecture 7: Minimum Spanning Trees Dan Grossman Fall 03 Spanning Trees A simple problem: Given a connected undirected graph G=(V,E), find a minimal subset of edges such

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

Graph Algorithms. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico.

Graph Algorithms. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico. Graph Algorithms Parallel and Distributed Computing Department of Computer Science and Engineering (DEI) Instituto Superior Técnico May, 0 CPD (DEI / IST) Parallel and Distributed Computing 0-0-0 / Outline

More information

Lecture Summary CSC 263H. August 5, 2016

Lecture Summary CSC 263H. August 5, 2016 Lecture Summary CSC 263H August 5, 2016 This document is a very brief overview of what we did in each lecture, it is by no means a replacement for attending lecture or doing the readings. 1. Week 1 2.

More information

Graph Algorithms shortest paths, minimum spanning trees, etc.

Graph Algorithms shortest paths, minimum spanning trees, etc. SFO ORD LAX Graph Algorithms shortest paths, minimum spanning trees, etc. DFW Nancy Amato Parasol Lab, Dept. CSE, Texas A&M University Acknowledgement: These slides are adapted from slides provided with

More information

The ADT priority queue Orders its items by a priority value The first item removed is the one having the highest priority value

The ADT priority queue Orders its items by a priority value The first item removed is the one having the highest priority value The ADT priority queue Orders its items by a priority value The first item removed is the one having the highest priority value 1 Possible implementations Sorted linear implementations o Appropriate if

More information

Dijkstra s algorithm for shortest paths when no edges have negative weight.

Dijkstra s algorithm for shortest paths when no edges have negative weight. Lecture 14 Graph Algorithms II 14.1 Overview In this lecture we begin with one more algorithm for the shortest path problem, Dijkstra s algorithm. We then will see how the basic approach of this algorithm

More information

Weighted Graph Algorithms Presented by Jason Yuan

Weighted Graph Algorithms Presented by Jason Yuan Weighted Graph Algorithms Presented by Jason Yuan Slides: Zachary Friggstad Programming Club Meeting Weighted Graphs struct Edge { int u, v ; int w e i g h t ; // can be a double } ; Edge ( int uu = 0,

More information

Virtual University of Pakistan

Virtual University of Pakistan Virtual University of Pakistan Department of Computer Science Course Outline Course Instructor Dr. Sohail Aslam E mail Course Code Course Title Credit Hours 3 Prerequisites Objectives Learning Outcomes

More information

CSE 100 Minimum Spanning Trees Prim s and Kruskal

CSE 100 Minimum Spanning Trees Prim s and Kruskal CSE 100 Minimum Spanning Trees Prim s and Kruskal Your Turn The array of vertices, which include dist, prev, and done fields (initialize dist to INFINITY and done to false ): V0: dist= prev= done= adj:

More information

Minimum Spanning Trees

Minimum Spanning Trees CS124 Lecture 5 Spring 2011 Minimum Spanning Trees A tree is an undirected graph which is connected and acyclic. It is easy to show that if graph G(V,E) that satisfies any two of the following properties

More information

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem Minimum Spanning Trees (Forests) Given an undirected graph G=(V,E) with each edge e having a weight w(e) : Find a subgraph T of G of minimum total weight s.t. every pair of vertices connected in G are

More information

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved. Chapter 9 Greedy Technique Copyright 2007 Pearson Addison-Wesley. All rights reserved. Greedy Technique Constructs a solution to an optimization problem piece by piece through a sequence of choices that

More information

Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, )

Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, ) Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 1. if >. 2. error new key is greater than current key 3.. 4.. 5. if NIL and.

More information

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018 CS Section # Shortest Paths and MSTs //08 Shortest Paths There are types of shortest paths problems: Single source single destination Single source to all destinations All pairs shortest path In today

More information

Minimum Spanning Trees Ch 23 Traversing graphs

Minimum Spanning Trees Ch 23 Traversing graphs Next: Graph Algorithms Graphs Ch 22 Graph representations adjacency list adjacency matrix Minimum Spanning Trees Ch 23 Traversing graphs Breadth-First Search Depth-First Search 11/30/17 CSE 3101 1 Graphs

More information

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 8 Lecturer: David Wagner February 20, Notes 8 for CS 170

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 8 Lecturer: David Wagner February 20, Notes 8 for CS 170 UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 8 Lecturer: David Wagner February 20, 2003 Notes 8 for CS 170 1 Minimum Spanning Trees A tree is an undirected graph that is connected

More information

6.1 Minimum Spanning Trees

6.1 Minimum Spanning Trees CS124 Lecture 6 Fall 2018 6.1 Minimum Spanning Trees A tree is an undirected graph which is connected and acyclic. It is easy to show that if graph G(V,E) that satisfies any two of the following properties

More information

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018 CS 4 Section # Shortest Paths and MSTs //08 Shortest Paths There are types of shortest paths problems: Single source single destination Single source to all destinations All pairs shortest path In today

More information

Lecture 10: Analysis of Algorithms (CS ) 1

Lecture 10: Analysis of Algorithms (CS ) 1 Lecture 10: Analysis of Algorithms (CS583-002) 1 Amarda Shehu November 05, 2014 1 Some material adapted from Kevin Wayne s Algorithm Class @ Princeton 1 Topological Sort Strongly Connected Components 2

More information

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast

More information

Minimum Spanning Trees

Minimum Spanning Trees CSMPS 2200 Fall Minimum Spanning Trees Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk 11/6/ CMPS 2200 Intro. to Algorithms 1 Minimum spanning trees Input: A

More information

CSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms

CSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms CSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms Professor Henry Carter Fall 2016 Recap Greedy algorithms iterate locally optimal choices to construct a globally optimal solution

More information

Graph Algorithms (part 3 of CSC 282),

Graph Algorithms (part 3 of CSC 282), Graph Algorithms (part of CSC 8), http://www.cs.rochester.edu/~stefanko/teaching/11cs8 Homework problem sessions are in CSB 601, 6:1-7:1pm on Oct. (Wednesday), Oct. 1 (Wednesday), and on Oct. 19 (Wednesday);

More information

2.1 Greedy Algorithms. 2.2 Minimum Spanning Trees. CS125 Lecture 2 Fall 2016

2.1 Greedy Algorithms. 2.2 Minimum Spanning Trees. CS125 Lecture 2 Fall 2016 CS125 Lecture 2 Fall 2016 2.1 Greedy Algorithms We will start talking about methods high-level plans for constructing algorithms. One of the simplest is just to have your algorithm be greedy. Being greedy,

More information

Graph Algorithms. Definition

Graph Algorithms. Definition Graph Algorithms Many problems in CS can be modeled as graph problems. Algorithms for solving graph problems are fundamental to the field of algorithm design. Definition A graph G = (V, E) consists of

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 9 Minimum Spanning Trees Thanks to the text authors who contributed to these slides Why Minimum Spanning Trees (MST)? Example 1 A

More information

Module 5 Graph Algorithms

Module 5 Graph Algorithms Module 5 Graph lgorithms Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 97 E-mail: natarajan.meghanathan@jsums.edu 5. Graph Traversal lgorithms Depth First

More information

Analysis of Algorithms, I

Analysis of Algorithms, I Analysis of Algorithms, I CSOR W4231.002 Eleni Drinea Computer Science Department Columbia University Thursday, March 8, 2016 Outline 1 Recap Single-source shortest paths in graphs with real edge weights:

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spanning Trees Overview Problem A town has a set of houses and a set of roads. A road connects and only houses. A road connecting houses u and v has a repair cost w(u, v). Goal: Repair enough (and

More information

CSE 431/531: Analysis of Algorithms. Greedy Algorithms. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo

CSE 431/531: Analysis of Algorithms. Greedy Algorithms. Lecturer: Shi Li. Department of Computer Science and Engineering University at Buffalo CSE 431/531: Analysis of Algorithms Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast algorithms to solve

More information

Unweighted Graphs & Algorithms

Unweighted Graphs & Algorithms Unweighted Graphs & Algorithms Zachary Friggstad Programming Club Meeting References Chapter 4: Graph (Section 4.2) Chapter 22: Elementary Graph Algorithms Graphs Features: vertices/nodes/dots and edges/links/lines

More information

CSci 231 Final Review

CSci 231 Final Review CSci 231 Final Review Here is a list of topics for the final. Generally you are responsible for anything discussed in class (except topics that appear italicized), and anything appearing on the homeworks.

More information

Graphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College

Graphs. Part II: SP and MST. Laura Toma Algorithms (csci2200), Bowdoin College Laura Toma Algorithms (csci2200), Bowdoin College Topics Weighted graphs each edge (u, v) has a weight denoted w(u, v) or w uv stored in the adjacency list or adjacency matrix The weight of a path p =

More information

Kruskal s MST Algorithm

Kruskal s MST Algorithm Kruskal s MST Algorithm CLRS Chapter 23, DPV Chapter 5 Version of November 5, 2014 Main Topics of This Lecture Kruskal s algorithm Another, but different, greedy MST algorithm Introduction to UNION-FIND

More information

( ) n 3. n 2 ( ) D. Ο

( ) n 3. n 2 ( ) D. Ο CSE 0 Name Test Summer 0 Last Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. The time to multiply two n n matrices is: A. Θ( n) B. Θ( max( m,n, p) ) C.

More information

Introduction to Optimization

Introduction to Optimization Introduction to Optimization Greedy Algorithms October 28, 2016 École Centrale Paris, Châtenay-Malabry, France Dimo Brockhoff Inria Saclay Ile-de-France 2 Course Overview Date Fri, 7.10.2016 Fri, 28.10.2016

More information

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo

More information

COMP 251 Winter 2017 Online quizzes with answers

COMP 251 Winter 2017 Online quizzes with answers COMP 251 Winter 2017 Online quizzes with answers Open Addressing (2) Which of the following assertions are true about open address tables? A. You cannot store more records than the total number of slots

More information

Algorithms (IX) Yijia Chen Shanghai Jiaotong University

Algorithms (IX) Yijia Chen Shanghai Jiaotong University Algorithms (IX) Yijia Chen Shanghai Jiaotong University Review of the Previous Lecture Shortest paths in the presence of negative edges Negative edges Dijkstra s algorithm works in part because the shortest

More information

Graphs. There is no restriction on the relation E. Directed graphs also known as digraphs

Graphs. There is no restriction on the relation E. Directed graphs also known as digraphs 3: Graphs Graphs A directed graph is a pair (N,E) consisting of a set of nodes (or vertices) N, together with a relation E on N. Each element (n 1,n 2 ) of E is called an edge There is no restriction on

More information

CS 170 Second Midterm ANSWERS 7 April NAME (1 pt): SID (1 pt): TA (1 pt): Name of Neighbor to your left (1 pt):

CS 170 Second Midterm ANSWERS 7 April NAME (1 pt): SID (1 pt): TA (1 pt): Name of Neighbor to your left (1 pt): CS 170 Second Midterm ANSWERS 7 April 2010 NAME (1 pt): SID (1 pt): TA (1 pt): Name of Neighbor to your left (1 pt): Name of Neighbor to your right (1 pt): Instructions: This is a closed book, closed calculator,

More information

Graph Representation

Graph Representation Graph Representation Adjacency list representation of G = (V, E) An array of V lists, one for each vertex in V Each list Adj[u] contains all the vertices v such that there is an edge between u and v Adj[u]

More information

Announcements Problem Set 5 is out (today)!

Announcements Problem Set 5 is out (today)! CSC263 Week 10 Announcements Problem Set is out (today)! Due Tuesday (Dec 1) Minimum Spanning Trees The Graph of interest today A connected undirected weighted graph G = (V, E) with weights w(e) for each

More information

END-TERM EXAMINATION

END-TERM EXAMINATION (Please Write your Exam Roll No. immediately) Exam. Roll No... END-TERM EXAMINATION Paper Code : MCA-205 DECEMBER 2006 Subject: Design and analysis of algorithm Time: 3 Hours Maximum Marks: 60 Note: Attempt

More information

CS 6783 (Applied Algorithms) Lecture 5

CS 6783 (Applied Algorithms) Lecture 5 CS 6783 (Applied Algorithms) Lecture 5 Antonina Kolokolova January 19, 2012 1 Minimum Spanning Trees An undirected graph G is a pair (V, E); V is a set (of vertices or nodes); E is a set of (undirected)

More information

Representations of Weighted Graphs (as Matrices) Algorithms and Data Structures: Minimum Spanning Trees. Weighted Graphs

Representations of Weighted Graphs (as Matrices) Algorithms and Data Structures: Minimum Spanning Trees. Weighted Graphs Representations of Weighted Graphs (as Matrices) A B Algorithms and Data Structures: Minimum Spanning Trees 9.0 F 1.0 6.0 5.0 6.0 G 5.0 I H 3.0 1.0 C 5.0 E 1.0 D 28th Oct, 1st & 4th Nov, 2011 ADS: lects

More information

logn D. Θ C. Θ n 2 ( ) ( ) f n B. nlogn Ο n2 n 2 D. Ο & % ( C. Θ # ( D. Θ n ( ) Ω f ( n)

logn D. Θ C. Θ n 2 ( ) ( ) f n B. nlogn Ο n2 n 2 D. Ο & % ( C. Θ # ( D. Θ n ( ) Ω f ( n) CSE 0 Test Your name as it appears on your UTA ID Card Fall 0 Multiple Choice:. Write the letter of your answer on the line ) to the LEFT of each problem.. CIRCLED ANSWERS DO NOT COUNT.. points each. The

More information