Algorithms: Minimum Spanning Trees

Size: px
Start display at page:

Download "Algorithms: Minimum Spanning Trees"

Transcription

1 Algorithms: Minimum Spanning Trees Amotz Bar-Noy CUNY Spring 0 Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

2 Minimum Spanning Trees (MST) Input: An undirected and connected graph G = (V, E) with n vertices and m edges. A weight function w : E R on the edges. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

3 Minimum Spanning Trees (MST) Input: An undirected and connected graph G = (V, E) with n vertices and m edges. A weight function w : E R on the edges. A spanning tree: A connected sub-graph with n edges. A minimum spanning tree (MST): A spanning tree for which the sum of the weights of the n edges is minimum. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

4 Minimum Spanning Trees (MST) Input: An undirected and connected graph G = (V, E) with n vertices and m edges. A weight function w : E R on the edges. A spanning tree: A connected sub-graph with n edges. A minimum spanning tree (MST): A spanning tree for which the sum of the weights of the n edges is minimum. Two greedy algorithms: Kruskal - O(m log m)-time, a distributed algorithm. Prim - O(m + n log n)-time, a centralized algorithm. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

5 Example: A weighted Graph A D F 3 E 5 C 3 B Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 3 / 59

6 Example: A BFS Spanning Tree A D F 3 E 5 C 3 W (T ) = B Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

7 Example: A DFS Spanning Tree A D F 3 E 5 C 3 W (T ) = B Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 5 / 59

8 Example: An MST A D F 3 E 5 C 3 W (T ) = 3 B Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 6 / 59

9 Example: Another MST A D F 3 E 5 C 3 W (T ) = 3 B Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 7 / 59

10 Cuts A cut S, (V S) in a graph is a partition of the set of vertices V into two disjoint sets: V = S (V S). An edge (u, v) crosses a cut S, (V S) if (u S & v (V S)) or (v S & u (V S)). An edge (u, v) is contained in a cut S, (V S) if (u, v) S or (u, v) (V S). A set A of edges is contained in a cut S, (V S) if all of the edges of A are contained in the cut. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 8 / 59

11 Example: A Cut A D F E C B An {ABDE}, {CF} cut Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 9 / 59

12 Example: Another Cut A D F E C An {AEF}, {BCD} cut B Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 0 / 59

13 Minimal Forests A set A of edges is a minimal forest if it is possible to add edges to A to become a minimal spanning tree. An empty set is in particular a minimal forest. A minimum spanning tree is in particular a minimal forest. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

14 A Minimal Forest A weighted graph: A B C D Minimal forests: A A B C B C D D Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

15 A Minimal Forest A weighted graph: A B C D Not a minimal forest: A B C D Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 3 / 59

16 The Greedy Lemma Input: A weighted connected graph G = (V, E). A minimal forest A E. A cut S, (V S) that contains A. An edge (u, v) crossing S, (V S) with minimum weight. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

17 The Greedy Lemma Input: A weighted connected graph G = (V, E). A minimal forest A E. A cut S, (V S) that contains A. An edge (u, v) crossing S, (V S) with minimum weight. Lemma: A {(u, v)} is also a minimal forest. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

18 Proof x u v y A vertex in S A vertex in V S An edge in A An edge in T A An edge not in T An MST T that contains A and (u, v) / T. (x, y) T crossing S, (V S) w(u, v) w(x, y). T = T {(x, y)} {(u, v)} T is also an MST. A {(u, v)} is a minimal forest. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 5 / 59

19 A Schematic Greedy Algorithm () A = () while A < n do (3) find (u, v) s.t. A {(u, v)} is a minimal forest () A = A {(u, v)} (5) return(a) Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 6 / 59

20 A Schematic Greedy Algorithm () A = () while A < n do (3) find (u, v) s.t. A {(u, v)} is a minimal forest () A = A {(u, v)} (5) return(a) Correctness: Due to the lemma, step (3) is always possible. By definition, A is always a minimal forest. At the end A has n edges. A forest with n edges is a tree. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 6 / 59

21 A Schematic Greedy Algorithm () A = () while A < n do (3) find (u, v) s.t. A {(u, v)} is a minimal forest () A = A {(u, v)} (5) return(a) Correctness: Due to the lemma, step (3) is always possible. By definition, A is always a minimal forest. At the end A has n edges. A forest with n edges is a tree. Complexity: Depends on the implementation of step (3). Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 6 / 59

22 Kruskal Algorithm Sort the edges from the lightest to the heaviest. Consider the edges following this order. Start with an empty minimal forest. Add an edge to the minimal forest if it doesn t close a cycle. Terminate when there are n edges in the minimal forest. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 7 / 59

23 Example: Kruskal Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 8 / 59

24 Example: Kruskal Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 9 / 59

25 Example: Kruskal Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 0 / 59

26 Example: Kruskal Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

27 Example: Kruskal Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

28 Example: Kruskal Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 3 / 59

29 Example: Kruskal Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

30 Example: Kruskal Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 5 / 59

31 Example: Kruskal Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 6 / 59

32 Kruskal Algorithm Data Structure A collection S of disjoint sets of vertices: {S, S,..., S k } S i S j = for all i j k. Initially, the collection is empty: S =. At the end S contains one set of all the vertices: S = {V }. Make-Set(x): Creates a new set containing only x and adds it to the collection S: S = S {{x}}. Find-Set(x): Finds the set in the collection S that contains x: S i S such that x S i. Union(S i, S j ): replaces in the collection S the two sets S i and S j with their union: S = S { S i, S j } { Si S j }. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 7 / 59

33 Kruskal Algorithm Code Variables: A: A minimal forest. Each tree in A is represented by a set of vertices. Algorithm: () A = () for all v V do Make-Set(v) (3) Sort(E) all edges from min to max () for each edge (u, v) in sorted order do (5) if Find-Set(u) Find-Set(v) then (6) A = A {(u, v)} (7) Union(Find-Set(u),Find-Set(v)) (8) return (A) Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 8 / 59

34 Kruskal Algorithm Correctness Assume to the contrary that the output set A is not an MST. Let (u, v) be the first edge that was added to A such that A {(u, v)} is not a minimal forest. In particular, at that time, A is a minimal forest. Let C = S, (V S) be a cut for the set u S. (u, v) crosses C since v belongs to another set. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 9 / 59

35 Kruskal Algorithm Correctness Any lighter edge (x, y) is contained in C: If (x, y) A, then both x and y belong to the same set before (x, y) was examined. If (x, y) A, then both x and y belong to the same set after (x, y) was examined. Sorting (u, v) is a minimal crossing edge for the cut C. Greedy lemma A {(u, v)} is a minimal forest. A contradiction. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 30 / 59

36 Kruskal Algorithm Complexity Sorting complexity: O(m log m). Set operations complexity: There are n Make-Set operations. There are O(m) Find-Set operations. There are n Union operations. Possible to implement in time: O(m α(m, n)). α(m, n) is the inverse of the Ackerman s function. The α(m, n) function grows very slowly. For example, m, n 0 80 α(m, n). Overall complexity: O(m log m). Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 3 / 59

37 The Ackerman s Function n for k = 0 and n 0 A k (n) = A k () for k and n = A k (A k (n )) for k and n Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 3 / 59

38 The Ackerman s Function n for k = 0 and n 0 A k (n) = A k () for k and n = A k (A k (n )) for k and n A 0 (n) = + + = n The multiply-by- function. A (n) = = n The power-of- function. A (n) =... With n s, the tower-of- function. Each recursive level does the previous level s operation n times. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 3 / 59

39 The Ackerman s Function n for k = 0 and n 0 A k (n) = A k () for k and n = A k (A k (n )) for k and n A 0 (n) = + + = n The multiply-by- function. A (n) = = n The power-of- function. A (n) =... With n s, the tower-of- function. Each recursive level does the previous level s operation n times. A () = = 6 = Already A 3 () and A () must be extremely large! Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 3 / 59

40 Very Slow Growing Functions log n the inverse of the tower-of- function is the least x such that... x times is greater or equal to n. For example, log ( ) = 5. α(n) the inverse Ackerman s function is the least x such that A x (x) n. α(n) is much slower than log n. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 33 / 59

41 Kruskal Algorithm A Simple Implementation A set is represented by the following linked list: Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 3 / 59

42 Kruskal Algorithm A Simple Implementation A set is represented by the following linked list: Set Name Set Size Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 3 / 59

43 Kruskal Algorithm A Simple Implementation The head of the set contains two fields: the name and the size of the set. The head of the set has two pointers: to the head and the tail of a linked list of vertices. An array of n vertices each has two pointers: to the head of its set and to the next vertex in its linked list. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 35 / 59

44 Kruskal Algorithm A Simple Implementation Make-Set(x) O() complexity. S x Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 36 / 59

45 Kruskal Algorithm A Simple Implementation Find-Set(x) O() complexity. S s x Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 37 / 59

46 Kruskal Algorithm A Simple Implementation Union(R, S) O(s) complexity. R r a b S s c d RS r+s a b c d Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 38 / 59

47 The Union Operation Implementation Worst case complexity: Connect the larger set to the smaller set. Consider the n Union operations: Union(S, S ), Union(S 3, S ),..., Union(S n, S n ) The cost of Union(S i+, S i ) is Ω(i). Total cost for the Union operations: Ω() + Ω() + + Ω(n ) = Ω(n ). Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 39 / 59

48 The Union Operation Implementation Worst case complexity: Connect the larger set to the smaller set. Consider the n Union operations: Union(S, S ), Union(S 3, S ),..., Union(S n, S n ) The cost of Union(S i+, S i ) is Ω(i). Total cost for the Union operations: Ω() + Ω() + + Ω(n ) = Ω(n ). Modification: Connect the smaller set to the larger set. The pointer of each vertex is changed at most log n times, since after each Union operation the pointer points to a set whose size is at least twice the size of the previous set. All together, for the n Union operations, for all vertices, O(n log n) complexity. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 39 / 59

49 Implementation Complexity n Union operations: O(n log n). n Make-Set operations: n Θ() = Θ(n). O(m) Find-Set operations: O(m) Θ() = Θ(m). Sorting complexity: Θ(m log m) = Θ(m log n). Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 0 / 59

50 Implementation Complexity n Union operations: O(n log n). n Make-Set operations: n Θ() = Θ(n). O(m) Find-Set operations: O(m) Θ() = Θ(m). Sorting complexity: Θ(m log m) = Θ(m log n). Kruskal algorithm complexity: Θ(m log m). Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 0 / 59

51 Prim Algorithm Start with an arbitrary vertex as a singleton tree. Maintain a minimal forest initially set to be this tree. Find the closest vertex to the minimal forest. Add this vertex and its closest edge to the minimal forest. Continue until all vertices are in the minimal forest. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

52 Example: Prim Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

53 Example: Prim Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 3 / 59

54 Example: Prim Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 / 59

55 Example: Prim Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 5 / 59

56 Example: Prim Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 6 / 59

57 Example: Prim Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 7 / 59

58 Example: Prim Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 8 / 59

59 Example: Prim Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 9 / 59

60 Example: Prim Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 50 / 59

61 Example: Prim Algorithm B 8 7 C D A I 9 E H G F Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 5 / 59

62 Prim Algorithm Implementing the Greedy Idea Data structure: A minimal tree (forest) A that will be the MST. A starting vertex r that is the root of the MST. A priority queue Q for vertices not yet in A. A distance key(v) from A for vertices in Q. A candidate edge (v, Π(v)) for any vertex v in Q. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 5 / 59

63 Prim Algorithm Implementing the Greedy Idea Data structure: A minimal tree (forest) A that will be the MST. A starting vertex r that is the root of the MST. A priority queue Q for vertices not yet in A. A distance key(v) from A for vertices in Q. A candidate edge (v, Π(v)) for any vertex v in Q. The greedy idea: Repeat adding to A the edge (u, Π(u)) for the vertex u that has the minimum value for key( ) in Q. Update, if necessary, the distance key(v) and the candidate edge (v, Π(v)) for each neighbor v of u that is still in Q. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 5 / 59

64 Prim Algorithm Code () initialize Π(r) = nil; A = ; Q = V {r} () for all u Q do key(u) = (3) u = r () Repeat (5) for each neighbor v of u do (6) if (v Q) and w(u, v) < key(v) then (7) key(v) = w(u, v); Π(v) = u (8) u =Extract-Min(Q) (9) A = A {(u, Π(u))} (0) until Q = () return (A) Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 53 / 59

65 Prim Algorithm Correctness Assume to the contrary that the output set A is not an MST. Let (u, v) be the first edge that was added to A such that A {(u, v)} is not a minimal forest. In particular, at that time, A is a minimal forest. Let C = Q, (V Q) be a cut. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 5 / 59

66 Prim Algorithm Correctness Assume to the contrary that the output set A is not an MST. Let (u, v) be the first edge that was added to A such that A {(u, v)} is not a minimal forest. In particular, at that time, A is a minimal forest. Let C = Q, (V Q) be a cut. The algorithm guarantees that C contains A. The priority queue implies that (u, v) is a minimal crossing edge for the cut C. Greedy lemma A {(u, v)} is a minimal forest. A contradiction. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 5 / 59

67 Prim Algorithm Complexity I Queue operations: One time building a priority queue. n times the operation Extract-Min. At most m times updating a value of a key. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 55 / 59

68 Prim Algorithm Complexity I Queue operations: One time building a priority queue. n times the operation Extract-Min. At most m times updating a value of a key. An implementation with an unsorted array: Θ(n) to build a queue. Θ(n) for the Extract-Min operation. Θ() for the Update-Queue operation. Unsorted array total complexity: Θ(n) + (n ) Θ(n) + Θ(m) Θ() = Θ(n ) Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 55 / 59

69 Prim Algorithm Complexity II Queue operations: One time building a priority queue. n times the operation Extract-Min. At most m times updating a value of a key. An implementation with a sorted array: Θ(n) to build a queue. Θ() for the Extract-Min operation. Θ(n) for the Update-Queue operation. Sorted array total complexity: Θ(n) + (n ) Θ() + Θ(m) Θ(n) = Θ(nm) Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 56 / 59

70 Prim Algorithm Complexity III Queue operations: One time building a priority queue. n times the operation Extract-Min. At most m times updating a value of a key. An implementation with a heap: Θ(n) to build a queue. Θ(log n) for the Extract-Min operation. Θ(log n) for the Update-Queue operation. Heap total complexity: Θ(n) + (n ) Θ(log n) + Θ(m) Θ(log n) = Θ(m log n) Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 57 / 59

71 Prim Algorithm Complexity IV Queue operations: One time building a priority queue. n times the operation Extract-Min. At most m times updating a value of a key. An implementation with a Fibonacci heap: Θ(n) to build a queue. Θ(log n) for the Extract-Min operation. Θ() (amortized) for the Update-Queue operation. Fibonacci heap total complexity: Θ(n) + (n ) Θ(log n) + Θ(m) Θ() = Θ(m + n log n) Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 58 / 59

72 Kruskal vs. Prim Complexity: Kruskal is an O(m log m) algorithm. Prim is an O(m + n log n) algorithm. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 59 / 59

73 Kruskal vs. Prim Complexity: Kruskal is an O(m log m) algorithm. Prim is an O(m + n log n) algorithm. Implementation: Kruskal is a distributed algorithm. Prim is a centralized algorithm. Amotz Bar-Noy (CUNY) Minimum Spanning Trees Spring 0 59 / 59

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92. Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure

More information

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, cheapest first, we had to determine whether its two endpoints

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, February 26, 2015 Outline 1 Recap 2 Representing graphs 3 Breadth-first search (BFS) 4 Applications

More information

Solutions to Homework 6

Solutions to Homework 6 Solutions to Homework 6 Debasish Das EECS Department, Northwestern University ddas@northwestern.edu 1 Problem 5.24 We want to find light spanning trees with certain special properties. Given is one example

More information

CS711008Z Algorithm Design and Analysis

CS711008Z Algorithm Design and Analysis CS711008Z Algorithm Design and Analysis Lecture 7 Binary heap, binomial heap, and Fibonacci heap 1 Dongbo Bu Institute of Computing Technology Chinese Academy of Sciences, Beijing, China 1 The slides were

More information

Exam study sheet for CS2711. List of topics

Exam study sheet for CS2711. List of topics Exam study sheet for CS2711 Here is the list of topics you need to know for the final exam. For each data structure listed below, make sure you can do the following: 1. Give an example of this data structure

More information

Data Structures Fibonacci Heaps, Amortized Analysis

Data Structures Fibonacci Heaps, Amortized Analysis Chapter 4 Data Structures Fibonacci Heaps, Amortized Analysis Algorithm Theory WS 2012/13 Fabian Kuhn Fibonacci Heaps Lacy merge variant of binomial heaps: Do not merge trees as long as possible Structure:

More information

ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN. Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015

ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN. Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015 ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015 ONLINE STEINER FOREST PROBLEM An initially given graph G. s 1 s 2 A sequence of demands (s i, t i ) arriving

More information

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes. 1. The advantage of.. is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists. [A] Lists [B] Linked Lists [A] Trees [A] Queues 2. The

More information

Lecture 10 Union-Find The union-nd data structure is motivated by Kruskal's minimum spanning tree algorithm (Algorithm 2.6), in which we needed two operations on disjoint sets of vertices: determine whether

More information

Minimum Spanning Trees

Minimum Spanning Trees Minimum Spanning Trees weighted graph API cycles and cuts Kruskal s algorithm Prim s algorithm advanced topics References: Algorithms in Java, Chapter 20 http://www.cs.princeton.edu/introalgsds/54mst 1

More information

Social Media Mining. Graph Essentials

Social Media Mining. Graph Essentials Graph Essentials Graph Basics Measures Graph and Essentials Metrics 2 2 Nodes and Edges A network is a graph nodes, actors, or vertices (plural of vertex) Connections, edges or ties Edge Node Measures

More information

CIS 700: algorithms for Big Data

CIS 700: algorithms for Big Data CIS 700: algorithms for Big Data Lecture 6: Graph Sketching Slides at http://grigory.us/big-data-class.html Grigory Yaroslavtsev http://grigory.us Sketching Graphs? We know how to sketch vectors: v Mv

More information

Strategic Deployment in Graphs. 1 Introduction. v 1 = v s. v 2. v 4. e 1. e 5 25. e 3. e 2. e 4

Strategic Deployment in Graphs. 1 Introduction. v 1 = v s. v 2. v 4. e 1. e 5 25. e 3. e 2. e 4 Informatica 39 (25) 237 247 237 Strategic Deployment in Graphs Elmar Langetepe and Andreas Lenerz University of Bonn, Department of Computer Science I, Germany Bernd Brüggemann FKIE, Fraunhofer-Institute,

More information

Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014

Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014 Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li Advised by: Dave Mount May 22, 2014 1 INTRODUCTION In this report we consider the implementation of an efficient

More information

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs CSE599s: Extremal Combinatorics November 21, 2011 Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs Lecturer: Anup Rao 1 An Arithmetic Circuit Lower Bound An arithmetic circuit is just like

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 27 Approximation Algorithms Load Balancing Weighted Vertex Cover Reminder: Fill out SRTEs online Don t forget to click submit Sofya Raskhodnikova 12/6/2011 S. Raskhodnikova;

More information

5.1 Bipartite Matching

5.1 Bipartite Matching CS787: Advanced Algorithms Lecture 5: Applications of Network Flow In the last lecture, we looked at the problem of finding the maximum flow in a graph, and how it can be efficiently solved using the Ford-Fulkerson

More information

A Turán Type Problem Concerning the Powers of the Degrees of a Graph

A Turán Type Problem Concerning the Powers of the Degrees of a Graph A Turán Type Problem Concerning the Powers of the Degrees of a Graph Yair Caro and Raphael Yuster Department of Mathematics University of Haifa-ORANIM, Tivon 36006, Israel. AMS Subject Classification:

More information

Distributed Computing over Communication Networks: Maximal Independent Set

Distributed Computing over Communication Networks: Maximal Independent Set Distributed Computing over Communication Networks: Maximal Independent Set What is a MIS? MIS An independent set (IS) of an undirected graph is a subset U of nodes such that no two nodes in U are adjacent.

More information

6 March 2007 1. Array Implementation of Binary Trees

6 March 2007 1. Array Implementation of Binary Trees Heaps CSE 0 Winter 00 March 00 1 Array Implementation of Binary Trees Each node v is stored at index i defined as follows: If v is the root, i = 1 The left child of v is in position i The right child of

More information

APP INVENTOR. Test Review

APP INVENTOR. Test Review APP INVENTOR Test Review Main Concepts App Inventor Lists Creating Random Numbers Variables Searching and Sorting Data Linear Search Binary Search Selection Sort Quick Sort Abstraction Modulus Division

More information

International Journal of Software and Web Sciences (IJSWS) www.iasir.net

International Journal of Software and Web Sciences (IJSWS) www.iasir.net International Association of Scientific Innovation and Research (IASIR) (An Association Unifying the Sciences, Engineering, and Applied Research) ISSN (Print): 2279-0063 ISSN (Online): 2279-0071 International

More information

Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, 2010. Chapter 7: Digraphs

Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, 2010. Chapter 7: Digraphs MCS-236: Graph Theory Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, 2010 Chapter 7: Digraphs Strong Digraphs Definitions. A digraph is an ordered pair (V, E), where V is the set

More information

Cpt S 223. School of EECS, WSU

Cpt S 223. School of EECS, WSU Priority Queues (Heaps) 1 Motivation Queues are a standard mechanism for ordering tasks on a first-come, first-served basis However, some tasks may be more important or timely than others (higher priority)

More information

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R Binary Search Trees A Generic Tree Nodes in a binary search tree ( B-S-T) are of the form P parent Key A Satellite data L R B C D E F G H I J The B-S-T has a root node which is the only node whose parent

More information

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8] Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)

More information

Triangle deletion. Ernie Croot. February 3, 2010

Triangle deletion. Ernie Croot. February 3, 2010 Triangle deletion Ernie Croot February 3, 2010 1 Introduction The purpose of this note is to give an intuitive outline of the triangle deletion theorem of Ruzsa and Szemerédi, which says that if G = (V,

More information

MapReduce and Distributed Data Analysis. Sergei Vassilvitskii Google Research

MapReduce and Distributed Data Analysis. Sergei Vassilvitskii Google Research MapReduce and Distributed Data Analysis Google Research 1 Dealing With Massive Data 2 2 Dealing With Massive Data Polynomial Memory Sublinear RAM Sketches External Memory Property Testing 3 3 Dealing With

More information

CS 598CSC: Combinatorial Optimization Lecture date: 2/4/2010

CS 598CSC: Combinatorial Optimization Lecture date: 2/4/2010 CS 598CSC: Combinatorial Optimization Lecture date: /4/010 Instructor: Chandra Chekuri Scribe: David Morrison Gomory-Hu Trees (The work in this section closely follows [3]) Let G = (V, E) be an undirected

More information

Binary Search Trees CMPSC 122

Binary Search Trees CMPSC 122 Binary Search Trees CMPSC 122 Note: This notes packet has significant overlap with the first set of trees notes I do in CMPSC 360, but goes into much greater depth on turning BSTs into pseudocode than

More information

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* Rakesh Nagi Department of Industrial Engineering University at Buffalo (SUNY) *Lecture notes from Network Flows by Ahuja, Magnanti

More information

Network File Storage with Graceful Performance Degradation

Network File Storage with Graceful Performance Degradation Network File Storage with Graceful Performance Degradation ANXIAO (ANDREW) JIANG California Institute of Technology and JEHOSHUA BRUCK California Institute of Technology A file storage scheme is proposed

More information

6.852: Distributed Algorithms Fall, 2009. Class 2

6.852: Distributed Algorithms Fall, 2009. Class 2 .8: Distributed Algorithms Fall, 009 Class Today s plan Leader election in a synchronous ring: Lower bound for comparison-based algorithms. Basic computation in general synchronous networks: Leader election

More information

8.1 Min Degree Spanning Tree

8.1 Min Degree Spanning Tree CS880: Approximations Algorithms Scribe: Siddharth Barman Lecturer: Shuchi Chawla Topic: Min Degree Spanning Tree Date: 02/15/07 In this lecture we give a local search based algorithm for the Min Degree

More information

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm. Approximation Algorithms 11 Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of three

More information

Converting a Number from Decimal to Binary

Converting a Number from Decimal to Binary Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive

More information

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm. Approximation Algorithms Chapter Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of

More information

Sample Questions Csci 1112 A. Bellaachia

Sample Questions Csci 1112 A. Bellaachia Sample Questions Csci 1112 A. Bellaachia Important Series : o S( N) 1 2 N N i N(1 N) / 2 i 1 o Sum of squares: N 2 N( N 1)(2N 1) N i for large N i 1 6 o Sum of exponents: N k 1 k N i for large N and k

More information

Approximated Distributed Minimum Vertex Cover Algorithms for Bounded Degree Graphs

Approximated Distributed Minimum Vertex Cover Algorithms for Bounded Degree Graphs Approximated Distributed Minimum Vertex Cover Algorithms for Bounded Degree Graphs Yong Zhang 1.2, Francis Y.L. Chin 2, and Hing-Fung Ting 2 1 College of Mathematics and Computer Science, Hebei University,

More information

PES Institute of Technology-BSC QUESTION BANK

PES Institute of Technology-BSC QUESTION BANK PES Institute of Technology-BSC Faculty: Mrs. R.Bharathi CS35: Data Structures Using C QUESTION BANK UNIT I -BASIC CONCEPTS 1. What is an ADT? Briefly explain the categories that classify the functions

More information

Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design

Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design Hongsik Choi and Hyeong-Ah Choi Department of Electrical Engineering and Computer Science George Washington University Washington,

More information

The Goldberg Rao Algorithm for the Maximum Flow Problem

The Goldberg Rao Algorithm for the Maximum Flow Problem The Goldberg Rao Algorithm for the Maximum Flow Problem COS 528 class notes October 18, 2006 Scribe: Dávid Papp Main idea: use of the blocking flow paradigm to achieve essentially O(min{m 2/3, n 1/2 }

More information

GRAPH THEORY LECTURE 4: TREES

GRAPH THEORY LECTURE 4: TREES GRAPH THEORY LECTURE 4: TREES Abstract. 3.1 presents some standard characterizations and properties of trees. 3.2 presents several different types of trees. 3.7 develops a counting method based on a bijection

More information

Mathematical Induction. Lecture 10-11

Mathematical Induction. Lecture 10-11 Mathematical Induction Lecture 10-11 Menu Mathematical Induction Strong Induction Recursive Definitions Structural Induction Climbing an Infinite Ladder Suppose we have an infinite ladder: 1. We can reach

More information

Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li Computer Algorithms NP-Complete Problems NP-completeness The quest for efficient algorithms is about finding clever ways to bypass the process of exhaustive search, using clues from the input in order

More information

Examination paper for MA0301 Elementær diskret matematikk

Examination paper for MA0301 Elementær diskret matematikk Department of Mathematical Sciences Examination paper for MA0301 Elementær diskret matematikk Academic contact during examination: Iris Marjan Smit a, Sverre Olaf Smalø b Phone: a 9285 0781, b 7359 1750

More information

Data Structure [Question Bank]

Data Structure [Question Bank] Unit I (Analysis of Algorithms) 1. What are algorithms and how they are useful? 2. Describe the factor on best algorithms depends on? 3. Differentiate: Correct & Incorrect Algorithms? 4. Write short note:

More information

CSC 505, Fall 2000: Week 8

CSC 505, Fall 2000: Week 8 Objecties: CSC 505, Fall 2000: Week 8 learn abot the basic depth-first search algorithm learn how properties of a graph can be inferred from the strctre of a DFS tree learn abot one nontriial application

More information

A Note on Maximum Independent Sets in Rectangle Intersection Graphs

A Note on Maximum Independent Sets in Rectangle Intersection Graphs A Note on Maximum Independent Sets in Rectangle Intersection Graphs Timothy M. Chan School of Computer Science University of Waterloo Waterloo, Ontario N2L 3G1, Canada tmchan@uwaterloo.ca September 12,

More information

Questions 1 through 25 are worth 2 points each. Choose one best answer for each.

Questions 1 through 25 are worth 2 points each. Choose one best answer for each. Questions 1 through 25 are worth 2 points each. Choose one best answer for each. 1. For the singly linked list implementation of the queue, where are the enqueues and dequeues performed? c a. Enqueue in

More information

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team Lecture Summary In this lecture, we learned about the ADT Priority Queue. A

More information

OPTIMAL DESIGN OF DISTRIBUTED SENSOR NETWORKS FOR FIELD RECONSTRUCTION

OPTIMAL DESIGN OF DISTRIBUTED SENSOR NETWORKS FOR FIELD RECONSTRUCTION OPTIMAL DESIGN OF DISTRIBUTED SENSOR NETWORKS FOR FIELD RECONSTRUCTION Sérgio Pequito, Stephen Kruzick, Soummya Kar, José M. F. Moura, A. Pedro Aguiar Department of Electrical and Computer Engineering

More information

Guessing Game: NP-Complete?

Guessing Game: NP-Complete? Guessing Game: NP-Complete? 1. LONGEST-PATH: Given a graph G = (V, E), does there exists a simple path of length at least k edges? YES 2. SHORTEST-PATH: Given a graph G = (V, E), does there exists a simple

More information

Any two nodes which are connected by an edge in a graph are called adjacent node.

Any two nodes which are connected by an edge in a graph are called adjacent node. . iscuss following. Graph graph G consist of a non empty set V called the set of nodes (points, vertices) of the graph, a set which is the set of edges and a mapping from the set of edges to a set of pairs

More information

Graphical degree sequences and realizations

Graphical degree sequences and realizations swap Graphical and realizations Péter L. Erdös Alfréd Rényi Institute of Mathematics Hungarian Academy of Sciences MAPCON 12 MPIPKS - Dresden, May 15, 2012 swap Graphical and realizations Péter L. Erdös

More information

1 Introduction. Dr. T. Srinivas Department of Mathematics Kakatiya University Warangal 506009, AP, INDIA tsrinivasku@gmail.com

1 Introduction. Dr. T. Srinivas Department of Mathematics Kakatiya University Warangal 506009, AP, INDIA tsrinivasku@gmail.com A New Allgoriitthm for Miiniimum Costt Liinkiing M. Sreenivas Alluri Institute of Management Sciences Hanamkonda 506001, AP, INDIA allurimaster@gmail.com Dr. T. Srinivas Department of Mathematics Kakatiya

More information

Chapter 6: Graph Theory

Chapter 6: Graph Theory Chapter 6: Graph Theory Graph theory deals with routing and network problems and if it is possible to find a best route, whether that means the least expensive, least amount of time or the least distance.

More information

Clustering UE 141 Spring 2013

Clustering UE 141 Spring 2013 Clustering UE 141 Spring 013 Jing Gao SUNY Buffalo 1 Definition of Clustering Finding groups of obects such that the obects in a group will be similar (or related) to one another and different from (or

More information

Chapter 11. 11.1 Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

Chapter 11. 11.1 Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling Approximation Algorithms Chapter Approximation Algorithms Q. Suppose I need to solve an NP-hard problem. What should I do? A. Theory says you're unlikely to find a poly-time algorithm. Must sacrifice one

More information

Well-Separated Pair Decomposition for the Unit-disk Graph Metric and its Applications

Well-Separated Pair Decomposition for the Unit-disk Graph Metric and its Applications Well-Separated Pair Decomposition for the Unit-disk Graph Metric and its Applications Jie Gao Department of Computer Science Stanford University Joint work with Li Zhang Systems Research Center Hewlett-Packard

More information

Section IV.1: Recursive Algorithms and Recursion Trees

Section IV.1: Recursive Algorithms and Recursion Trees Section IV.1: Recursive Algorithms and Recursion Trees Definition IV.1.1: A recursive algorithm is an algorithm that solves a problem by (1) reducing it to an instance of the same problem with smaller

More information

Algorithms and data structures

Algorithms and data structures Algorithms and data structures This course will examine various data structures for storing and accessing information together with relationships between the items being stored, and algorithms for efficiently

More information

SCAN: A Structural Clustering Algorithm for Networks

SCAN: A Structural Clustering Algorithm for Networks SCAN: A Structural Clustering Algorithm for Networks Xiaowei Xu, Nurcan Yuruk, Zhidan Feng (University of Arkansas at Little Rock) Thomas A. J. Schweiger (Acxiom Corporation) Networks scaling: #edges connected

More information

On the k-path cover problem for cacti

On the k-path cover problem for cacti On the k-path cover problem for cacti Zemin Jin and Xueliang Li Center for Combinatorics and LPMC Nankai University Tianjin 300071, P.R. China zeminjin@eyou.com, x.li@eyou.com Abstract In this paper we

More information

Cpt S 223. School of EECS, WSU

Cpt S 223. School of EECS, WSU The Shortest Path Problem 1 Shortest-Path Algorithms Find the shortest path from point A to point B Shortest in time, distance, cost, Numerous applications Map navigation Flight itineraries Circuit wiring

More information

Diversity Coloring for Distributed Data Storage in Networks 1

Diversity Coloring for Distributed Data Storage in Networks 1 Diversity Coloring for Distributed Data Storage in Networks 1 Anxiao (Andrew) Jiang and Jehoshua Bruck California Institute of Technology Pasadena, CA 9115, U.S.A. {jax, bruck}@paradise.caltech.edu Abstract

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms

More information

Motivation Suppose we have a database of people We want to gure out who is related to whom Initially, we only have a list of people, and information a

Motivation Suppose we have a database of people We want to gure out who is related to whom Initially, we only have a list of people, and information a CSE 220: Handout 29 Disjoint Sets 1 Motivation Suppose we have a database of people We want to gure out who is related to whom Initially, we only have a list of people, and information about relations

More information

Chapter 13: Query Processing. Basic Steps in Query Processing

Chapter 13: Query Processing. Basic Steps in Query Processing Chapter 13: Query Processing! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions 13.1 Basic Steps in Query Processing 1. Parsing

More information

Data Structures and Algorithm Analysis (CSC317) Intro/Review of Data Structures Focus on dynamic sets

Data Structures and Algorithm Analysis (CSC317) Intro/Review of Data Structures Focus on dynamic sets Data Structures and Algorithm Analysis (CSC317) Intro/Review of Data Structures Focus on dynamic sets We ve been talking a lot about efficiency in computing and run time. But thus far mostly ignoring data

More information

SEMITOTAL AND TOTAL BLOCK-CUTVERTEX GRAPH

SEMITOTAL AND TOTAL BLOCK-CUTVERTEX GRAPH CHAPTER 3 SEMITOTAL AND TOTAL BLOCK-CUTVERTEX GRAPH ABSTRACT This chapter begins with the notion of block distances in graphs. Using block distance we defined the central tendencies of a block, like B-radius

More information

Simple Graphs Degrees, Isomorphism, Paths

Simple Graphs Degrees, Isomorphism, Paths Mathematics for Computer Science MIT 6.042J/18.062J Simple Graphs Degrees, Isomorphism, Types of Graphs Simple Graph this week Multi-Graph Directed Graph next week Albert R Meyer, March 10, 2010 lec 6W.1

More information

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

More information

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation: CSE341T 08/31/2015 Lecture 3 Cost Model: Work, Span and Parallelism In this lecture, we will look at how one analyze a parallel program written using Cilk Plus. When we analyze the cost of an algorithm

More information

CMPSCI611: Approximating MAX-CUT Lecture 20

CMPSCI611: Approximating MAX-CUT Lecture 20 CMPSCI611: Approximating MAX-CUT Lecture 20 For the next two lectures we ll be seeing examples of approximation algorithms for interesting NP-hard problems. Today we consider MAX-CUT, which we proved to

More information

Computer Science Department. Technion - IIT, Haifa, Israel. Itai and Rodeh [IR] have proved that for any 2-connected graph G and any vertex s G there

Computer Science Department. Technion - IIT, Haifa, Israel. Itai and Rodeh [IR] have proved that for any 2-connected graph G and any vertex s G there - 1 - THREE TREE-PATHS Avram Zehavi Alon Itai Computer Science Department Technion - IIT, Haifa, Israel Abstract Itai and Rodeh [IR] have proved that for any 2-connected graph G and any vertex s G there

More information

Persistent Data Structures and Planar Point Location

Persistent Data Structures and Planar Point Location Persistent Data Structures and Planar Point Location Inge Li Gørtz Persistent Data Structures Ephemeral Partial persistence Full persistence Confluent persistence V1 V1 V1 V1 V2 q ue V2 V2 V5 V2 V4 V4

More information

Exponential time algorithms for graph coloring

Exponential time algorithms for graph coloring Exponential time algorithms for graph coloring Uriel Feige Lecture notes, March 14, 2011 1 Introduction Let [n] denote the set {1,..., k}. A k-labeling of vertices of a graph G(V, E) is a function V [k].

More information

Near Optimal Solutions

Near Optimal Solutions Near Optimal Solutions Many important optimization problems are lacking efficient solutions. NP-Complete problems unlikely to have polynomial time solutions. Good heuristics important for such problems.

More information

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list Scan-Line Fill Can also fill by maintaining a data structure of all intersections of polygons with scan lines Sort by scan line Fill each span vertex order generated by vertex list desired order Scan-Line

More information

Institut für Informatik Lehrstuhl Theoretische Informatik I / Komplexitätstheorie. An Iterative Compression Algorithm for Vertex Cover

Institut für Informatik Lehrstuhl Theoretische Informatik I / Komplexitätstheorie. An Iterative Compression Algorithm for Vertex Cover Friedrich-Schiller-Universität Jena Institut für Informatik Lehrstuhl Theoretische Informatik I / Komplexitätstheorie Studienarbeit An Iterative Compression Algorithm for Vertex Cover von Thomas Peiselt

More information

Complexity of Union-Split-Find Problems. Katherine Jane Lai

Complexity of Union-Split-Find Problems. Katherine Jane Lai Complexity of Union-Split-Find Problems by Katherine Jane Lai S.B., Electrical Engineering and Computer Science, MIT, 2007 S.B., Mathematics, MIT, 2007 Submitted to the Department of Electrical Engineering

More information

Small Maximal Independent Sets and Faster Exact Graph Coloring

Small Maximal Independent Sets and Faster Exact Graph Coloring Small Maximal Independent Sets and Faster Exact Graph Coloring David Eppstein Univ. of California, Irvine Dept. of Information and Computer Science The Exact Graph Coloring Problem: Given an undirected

More information

The Minimum Consistent Subset Cover Problem and its Applications in Data Mining

The Minimum Consistent Subset Cover Problem and its Applications in Data Mining The Minimum Consistent Subset Cover Problem and its Applications in Data Mining Byron J Gao 1,2, Martin Ester 1, Jin-Yi Cai 2, Oliver Schulte 1, and Hui Xiong 3 1 School of Computing Science, Simon Fraser

More information

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory CSC2420 Fall 2012: Algorithm Design, Analysis and Theory Allan Borodin November 15, 2012; Lecture 10 1 / 27 Randomized online bipartite matching and the adwords problem. We briefly return to online algorithms

More information

Attacking Anonymized Social Network

Attacking Anonymized Social Network Attacking Anonymized Social Network From: Wherefore Art Thou RX3579X? Anonymized Social Networks, Hidden Patterns, and Structural Steganography Presented By: Machigar Ongtang (Ongtang@cse.psu.edu ) Social

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures CMPSC 465 LECTURES 20-21 Priority Queues and Binary Heaps Adam Smith S. Raskhodnikova and A. Smith. Based on slides by C. Leiserson and E. Demaine. 1 Trees Rooted Tree: collection

More information

A simpler and better derandomization of an approximation algorithm for Single Source Rent-or-Buy

A simpler and better derandomization of an approximation algorithm for Single Source Rent-or-Buy A simpler and better derandomization of an approximation algorithm for Single Source Rent-or-Buy David P. Williamson Anke van Zuylen School of Operations Research and Industrial Engineering, Cornell University,

More information

1/18/2013. 5.5-year Ph.D. student internships in. Done job hunting recently. Will join Yahoo! Labs soon. Interviewed with

1/18/2013. 5.5-year Ph.D. student internships in. Done job hunting recently. Will join Yahoo! Labs soon. Interviewed with Liangjie Hong Ph.D. Candidate Dept. of Computer Science and Engineering 5.5-year Ph.D. student internships in a local software company (2008, 2 months) Yahoo! Labs (2010, 3 months) Yahoo! Labs (2011, 3

More information

Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction

Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction Lecture 11 Dynamic Programming 11.1 Overview Dynamic Programming is a powerful technique that allows one to solve many different types of problems in time O(n 2 ) or O(n 3 ) for which a naive approach

More information

Solutions for Introduction to algorithms second edition

Solutions for Introduction to algorithms second edition Solutions for Introduction to algorithms second edition Philip Bille The author of this document takes absolutely no responsibility for the contents. This is merely a vague suggestion to a solution to

More information

Simplified External memory Algorithms for Planar DAGs. July 2004

Simplified External memory Algorithms for Planar DAGs. July 2004 Simplified External Memory Algorithms for Planar DAGs Lars Arge Duke University Laura Toma Bowdoin College July 2004 Graph Problems Graph G = (V, E) with V vertices and E edges DAG: directed acyclic graph

More information

Data Structures. Jaehyun Park. CS 97SI Stanford University. June 29, 2015

Data Structures. Jaehyun Park. CS 97SI Stanford University. June 29, 2015 Data Structures Jaehyun Park CS 97SI Stanford University June 29, 2015 Typical Quarter at Stanford void quarter() { while(true) { // no break :( task x = GetNextTask(tasks); process(x); // new tasks may

More information

Closest Pair Problem

Closest Pair Problem Closest Pair Problem Given n points in d-dimensions, find two whose mutual distance is smallest. Fundamental problem in many applications as well as a key step in many algorithms. p q A naive algorithm

More information

Asking Hard Graph Questions. Paul Burkhardt. February 3, 2014

Asking Hard Graph Questions. Paul Burkhardt. February 3, 2014 Beyond Watson: Predictive Analytics and Big Data U.S. National Security Agency Research Directorate - R6 Technical Report February 3, 2014 300 years before Watson there was Euler! The first (Jeopardy!)

More information

Home Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit

Home Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit Data Structures Page 1 of 24 A.1. Arrays (Vectors) n-element vector start address + ielementsize 0 +1 +2 +3 +4... +n-1 start address continuous memory block static, if size is known at compile time dynamic,

More information

Seminar. Path planning using Voronoi diagrams and B-Splines. Stefano Martina stefano.martina@stud.unifi.it

Seminar. Path planning using Voronoi diagrams and B-Splines. Stefano Martina stefano.martina@stud.unifi.it Seminar Path planning using Voronoi diagrams and B-Splines Stefano Martina stefano.martina@stud.unifi.it 23 may 2016 This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Part 2: Data Structures PD Dr. rer. nat. habil. Ralf-Peter Mundani Computation in Engineering (CiE) Summer Term 2016 Overview general linked lists stacks queues trees 2 2

More information

Rotation Operation for Binary Search Trees Idea:

Rotation Operation for Binary Search Trees Idea: Rotation Operation for Binary Search Trees Idea: Change a few pointers at a particular place in the tree so that one subtree becomes less deep in exchange for another one becoming deeper. A sequence of

More information