DOC PREVIEW
ASU CSE 310 - CSE310-L27_Final_Review

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE310 Lecture 27: Overall ReviewFinal Exam LogisticsAsymptotic NotationsBinary-Search TreeExample: How to Insert a Node?Example: How to Delete a Node?Binary Search Tree - PerformanceRed-Black TreeHeaps and Priority QueuesDisjoint SetDSSlide 12Graphs and RepresentationsBreadth First Search and Depth First SearchMinimum Spanning TreesPowerPoint PresentationSlide 17Slide 18Topological OrderTopological Sort using queueSlide 21Shortest PathsSlide 23Dynamic Data StructuresSlide [email protected] Lecture 27:CSE310 Lecture 27:Overall ReviewOverall ReviewGuoliang (Larry) XueDepartment of CSEArizona State Universityhttp://www.fulton.asu.edu/[email protected] Exam LogisticsFinal Exam Logistics110 minutes, Closed Book/NotesYou are allowed one letter-sized cheat sheetNo electronic device allowedVisit the class website for [email protected] NotationsAsymptotic notations: the three symbols.Using the master method to solve recurrences: there are three cases.Commonly used [email protected] Treekey[left_child]<=key[parent]<=key[right_child]Where is the largest element stored in a BST?Where is the largest element in a min-heap?Tree walks:Pre-Order: root, left sub-tree, right sub-treeIn-Order: left sub-tree, root, right sub-treePost-Order: left sub-tree, right sub-tree, rootWhat does Successor(X) return?Insertion/[email protected]: How to Insert a Node?Example: How to Insert a Node?2 9512181917141413152 [email protected]: How to Delete a Node?Example: How to Delete a Node?Three cases:15531067231618201312z1553106723161820121553106723182013121563107231618201312y15536231618201312z107(1)no child15531067231618201312z(2)has one child15531067231618201312zy(3)[email protected] Search Tree - PerformanceBest/Average/Worst case scenarioSearch/Insertion/DeletionWhat is a balanced [email protected] Tree5 PropertiesWhat do these properties guarantee?Is RBT a balanced tree?No!But it is approximately balanced.What does that [email protected] and Priority QueuesBinary heap (min or max)InsertionDeletionDecrease Key (or Increase Key)Linear Time Build [email protected] SetArray representationFind with or without path compressionUnion by [email protected]Initial: 8 singleton setsUnion(1,2)Union(3,4)Union(2,4)Union(5,6)Union(7,8)Union(8,6)Union(3,7)[email protected]Find(8) w/o PCFind(8) w PCUnion(5,7)i 1 2 3 4 5 6 7 8A -3 1 1 3 4 3 0 [email protected] and RepresentationsGraphs and RepresentationsGraphs, vertices, edges, paths, cycles, connected components, strongly connected componentsRepresentations: adjacency matrix, adjacency list; Given one representation, draw the graph or construct another representation.The transpose of a directed [email protected] First Search and Depth First SearchBreadth First Search and Depth First SearchPerforming Breadth First SearchBFS TreePerforming Depth First SearchDFS TreeComputing discovery time and finish [email protected] Spanning TreesMinimum Spanning TreesDefinition of a spanning treeKruskal’s algorithm for computing a minimum spanning tree in an undirected graph. Know the algorithm and its time complexity.Prim’s algorithm for computing a minimum spanning tree in an undirected graph. Know the algorithm and its time complexity.Example for Kruskal’s AlgorithmExample for Prim’s [email protected] e481 2109782711 1446bhcgdfia e481 2109782711 1446bhcgdfia e481 2109782711 1446bhcgdfia e481 2109782711 1446bhcgdfia e481 2109782711 1446bhcgdfia e481 2109782711 1446bhcgdfia e481 2109782711 1446bhcgdfia e481 2109782711 [email protected]0Breadth-First Search Algorithmr s t uv w x ysQ0101r s t uv w x ywQr1 110122r s t uv w x yrQtx1 2 2120122r s t uv w x ytQxv2 2 21201223r s t uv w x yxQvu2 2 312012233r s t uv w x yQ = [email protected]/Depth-First Search Algorithmu v wx y z1/4/2/3/u v wx y z1/4/52/3/u v wx y zB1/4/52/73/6u v wx y zB1/4/52/73/6u v wx y zBF1/84/52/73/6u v wx y zBF1/84/52/73/69/u v wx y zBFC1/84/52/73/69/10/u v wx y zBFC1/84/52/73/69/1210/11u v wx y zBFC1/84/52/73/69/1210/11two [email protected] OrderTopological OrderWhat is a topological order.Linear time algorithm for computing a topological order or finding a directed cycle in a directed [email protected] Sort using queueTopological Sort using queue1. For each vertex v{2. Compute in-degree(v).3. Color v white.4. If in-degree(v)=0, insert v into a queue Q.}5. While Q is not empty{6. Delete v from Q.7. For all edges (v, u) do{8. in-degree(u)--;9. if in-degree(u)=0, insert u into Q;}10. color v black;}If all vertices are black, the order they are deleted from Q form a topological sort. Otherwise, the graph has a [email protected] Connected Components13/1412/1511/163/48/95/6a b de f h1/102/7cgGraphGabefgcdhComponentgraphStronglyconnectedcomponentsa b de f [email protected] PathsShortest PathsDefinitionsDijkstra’s algorithm for single-source shortest paths. Know the algorithm and its time complexity.Draw the Shortest Path [email protected]’s Single-Source Shortest Path Alg.Dijkstra-SP(G, w, s)1. Initialize-Single-Source(G, s)2. S := 3. Q := V[G]4. while Q   do5. u := Extract-Min(Q)6. S := S  {u}7. for each vertex v  u.adj do8. Relax(u, v, w)0105219326471050105219326478514010521932647785130105219326477859010521932647723Guoliang.Xue@asu.edu24Dynamic Data StructuresDynamic Data StructuresThe Heap Data StructureBinary Search TreesRed-Black TreesDisjoint [email protected] Data StructuresDynamic Data StructuresWhat data structures have the following properties?Insertion in log(n) timeDeletion in log(n) timeDecreaseKey in log(n) timeSearching in log(n)


View Full Document

ASU CSE 310 - CSE310-L27_Final_Review

Documents in this Course
Load more
Download CSE310-L27_Final_Review
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CSE310-L27_Final_Review and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CSE310-L27_Final_Review 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?