COP 3530 Spring2012 Data Structures & Algorithms Discussion Session.

Slides:



Advertisements
Similar presentations
1. Find the cost of each of the following using the Nearest Neighbor Algorithm. a)Start at Vertex M.
Advertisements

C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Topological Sort.
Minimum cost spanning tree and activity networks Data structure 2002/12/2.
Lecture 16: DFS, DAG, and Strongly Connected Components Shang-Hua Teng.
More Graphs COL 106 Slides from Naveen. Some Terminology for Graph Search A vertex is white if it is undiscovered A vertex is gray if it has been discovered.
Algorithms and Data Structures
Applications of graph traversals
Lecture 10 Topics Application of DFS Topological Sort
Lecture 16 CSE 331 Oct 9, Announcements Hand in your HW4 Solutions to HW4 next week Remember next week I will not be here so.
Spring 2010CS 2251 Graphs Chapter 10. Spring 2010CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs.
Course Review COMP171 Spring Hashing / Slide 2 Elementary Data Structures * Linked lists n Types: singular, doubly, circular n Operations: insert,
CS344: Lecture 16 S. Muthu Muthukrishnan. Graph Navigation BFS: DFS: DFS numbering by start time or finish time. –tree, back, forward and cross edges.
מבנה המחשב – מבוא למחשבים ספרתיים Foundations of Combinational Circuits תרגול מספר 3.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Bayes-ball—an Efficient Algorithm to Assess D-separation A Presentation for.
CS2420: Lecture 36 Vladimir Kulyukin Computer Science Department Utah State University.
Review of Graphs A graph is composed of edges E and vertices V that link the nodes together. A graph G is often denoted G=(V,E) where V is the set of vertices.
Important Problem Types and Fundamental Data Structures
Lecture 5 Sorting. Overview Mathematical Definition.
CISC 235: Topic 11 Shortest Paths Algorithms. CISC 235 Topic 112 Outline Single-Source Shortest Paths Algorithm for Unweighted Graphs Algorithm for Weighted,
Computer Science 112 Fundamentals of Programming II Graph Algorithms.
Lecture 13 Graphs. Introduction to Graphs Examples of Graphs – Airline Route Map What is the fastest way to get from Pittsburgh to St Louis? What is the.
Computer Science 112 Fundamentals of Programming II Introduction to Graphs.
Overview of Sorting by Ron Peterson. Variety of Algorithms There are a lot of different approaches to sorting, not just different programs that use similar.
Introduction to Graphs. Introduction Graphs are a generalization of trees –Nodes or verticies –Edges or arcs Two kinds of graphs –Directed –Undirected.
© 2004 Goodrich, Tamasia Recall: Digraphs A digraph is a graph whose edges are all directed Short for “directed graph” Applications one-way streets flights.
Topological Sort (an application of DFS) CSC263 Tutorial 9.
Teacher Talk There has never been a better time to teach Computer Science 2.We can learn from Chemistry, Physics, Biology, …
CS 61B Data Structures and Programming Methodology Aug 5, 2008 David Sun.
Section 13  Questions  Graphs. Graphs  A graph representation: –Adjacency matrix. Pros:? Cons:? –Neighbor lists. Pros:? Cons:?
Sorting 1. Insertion Sort
CSC2100B Tutorial 10 Graph Jianye Hao.
CSCI2100 Data Structures Tutorial 12
1 Algorithms CSCI 235, Fall 2015 Lecture 35 Graphs IV.
CSC317 1 At the same time: Breadth-first search tree: If node v is discovered after u then edge uv is added to the tree. We say that u is a predecessor.
Spanning Trees Alyce Brady CS 510: Computer Algorithms.
Topological Sort. Sorting technique over DAGs (Directed Acyclic Graphs) It creates a linear sequence (ordering) for the nodes such that: –If u has an.
CS 202, Spring 2003 Fundamental Structures of Computer Science II Bilkent University1 Graph Algorithms CS 202 – Fundamental Structures of Computer Science.
Fundamentals of Programming II Introduction to Trees
CS Fall 2012, Lab 02 Haohan Zhu.
Main algorithm with recursion: We’ll have a function DFS that initializes, and then calls DFS-Visit, which is a recursive function and does the depth first.
Lecture 12 Graph Algorithms
Topological Sort (an application of DFS)
Lecture 20 CSE 331 Oct 15, 2010.
Lecture 15 CSE 331 Oct 3, 2016.
CS200: Algorithm Analysis
SINGLE-SOURCE SHORTEST PATHS IN DAGs
More Graph Algorithms.
Topological Sort.
Graph Algorithm.
Lecture 15 CSE 331 Oct 3, 2016.
Topological Sort.
SINGLE-SOURCE SHORTEST PATHS
كلية المجتمع الخرج البرمجة - المستوى الثاني
Topological Sort Neil Tang 03/02/2010
"Learning how to learn is life's most important skill. " - Tony Buzan
CS223 Advanced Data Structures and Algorithms
Lecture 17 CSE 331 Oct 10, 2012.
Graph Representation (23.1/22.1)
Sorting.
CSCI2100 Data Structures Tutorial
A Introduction to Computing II Lecture 13: Trees
Topological Sort (an application of DFS)
Richard Anderson Winter 2009 Lecture 6
Lecture 17 CSE 331 Oct 7, 2011.
CSE 417: Algorithms and Computational Complexity
GRAPHS Lecture 17 CS2110 Spring 2018.
Algorithms CSCI 235, Spring 2019 Lecture 35 Graphs IV
Important Problem Types and Fundamental Data Structures
Richard Anderson Lecture 5 Graph Theory
DAGs Longin Jan Latecki
Presentation transcript:

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 Tournament sort Cocktail sort Comb sort Gnome sort Bogosort Slowsort Cycle sort Topological sort

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

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

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

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

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

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

Topological Sort

Example

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