1 / 13

COP 3530 Spring2012 Data Structures & Algorithms

COP 3530 Spring2012 Data Structures & Algorithms. Discussion Session. Sort. What is sort? Why sort? Examples Dictionary Search (Google) . Sorting Algorithms. Quicksort Merge sort Heapsort Insertion sort Selection sort Shell sort Bubble sort Strand sort. Smoothsort

annot
Download Presentation

COP 3530 Spring2012 Data Structures & Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COP 3530 Spring2012Data Structures & Algorithms Discussion Session

  2. Sort • What is sort? • Why sort? • Examples • Dictionary • Search (Google)

  3. 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

  4. Directional Acyclic Graph (DAG) • A set of vertices / directed edges • Directional • Acyclic

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

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

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

  8. 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

  9. 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

  10. Topological Sort

  11. Example

  12. Time Complexity • O(|N|+|E|)

More Related