Presentation is loading. Please wait.

Presentation is loading. Please wait.

COP 3530 Spring2012 Data Structures & Algorithms Discussion Session.

Similar presentations


Presentation on theme: "COP 3530 Spring2012 Data Structures & Algorithms Discussion Session."— Presentation transcript:

1 COP 3530 Spring2012 Data Structures & Algorithms Discussion Session

2

3 Sort What is sort? Why sort? Examples – Dictionary – Search (Google)

4 Sorting Algorithms Quicksort Merge sort Heapsort Insertion sort Selection sort Shell sort Bubble sort Strand sort Smoothsort Tournament sort Cocktail sort Comb sort Gnome sort Bogosort Slowsort Cycle sort Topological sort

5 Directional Acyclic Graph (DAG) A set of vertices / directed edges Directional Acyclic

6 Directional Acyclic Graph (DAG) Why directional? – Relation between objects are asymmetric – E.g., parent to child, predecessor to successor

7 Directional Acyclic Graph (DAG) Why acyclic? – A collection of tasks – Ordered, s.t., certain tasks must be performed earlier than others T4 T5 T3 T2T1 T8 T6 T7 T1 T2 T3

8 Directional Acyclic Graph (DAG) Applications? – Program language processing (fundamental in CS) – Real-world traffic scheduling – Computer network traffic scheduling – So on

9 Topological Order Topological ordering of a directed acyclic graph is a linear ordering of its vertices such that, for every edge uv, u comes before v in the ordering u v

10 Topological Order Left to right first, then top to bottom 7, 5, 3, 11, 8, 2, 9, 10 smallest-numbered available vertex first 3, 5, 7, 8, 11, 2, 9, 10 fewest edges first 5, 7, 3, 8, 11, 10, 9, 2 largest-numbered available vertex first 7, 5, 11, 3, 10, 8, 9, 2

11 Topological Sort

12 Example

13 Time Complexity O(|N|+|E|)


Download ppt "COP 3530 Spring2012 Data Structures & Algorithms Discussion Session."

Similar presentations


Ads by Google