DesignAnalysis Algorithms COMP 4030
University of Memphis
Popular in Course
verified elite notetaker
Popular in ComputerScienence
This 16 page Class Notes was uploaded by Dr. Marina Pollich on Friday October 23, 2015. The Class Notes belongs to COMP 4030 at University of Memphis taught by Staff in Fall. Since its upload, it has received 27 views. For similar materials see /class/228402/comp-4030-university-of-memphis in ComputerScienence at University of Memphis.
Reviews for DesignAnalysis Algorithms
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/23/15
COMP 46030 Introduction to Algorithms Sorting III February 15 2006 Outline o 4 sorting algorithms l v i i Heap sort 0 Lower bound 0 Aims Correctness Analysis running time Design divide and conquer Different algorithms for a same problem optimality Heap sort Combine the better of insertion and merge Algorithm design technique Use data structure to manage information during the execution of the algorithm 0 Heap Nearly complete binary tree Max heap property 0 Procedures Max heapify Build maXheap heapsort OO I39VIAK HEAFIFY Au i m E 1 Lawnquot r lt RIGHTi if 1 H and AH AU then hinges lt E EI SE largest lt E if39r n and ALP A m39g sr then Ea gesr r if fang2m 139 then exchange AU 3 A a gresr MAX HEAHF Y Au h g sr n BUILD NIAK HEAP39EA n fnri 139 LHEEJ dnwntn I In NIAXHEAHFTi39A L n HEA PSDRTEA n I BUILD MAK HELAP M n for i 1 n lawnm 2 In exchange AM 3 AU MAXHEAHF39HA Ii 239 Optimality 0 Which is asymptotically optimal Insertion sort Quick sort Merge sort Heap sort Lower bounds for comparison sorting o How fast can we sort 0 Lower bounds Qn to examine all the input All sorts seen so far are Qngn To prove Qnlgn is a lower bound 0 Decision tree Abstraction of any comparison sort 0 Abstract away everything else control and data movement 0 Count only comparisons Represents comparisons made by 0 A particular sorting algorithm 0 On input of a given size Optimality 0 Which is asymptotically optimal Merge sort Heap sort COMP 46030 Introduction to Algorithms Graph Optimization Problems amp Greedy Algorithms II March 22 2006 Outline O O O i g g o Single source shortest path ch 24 0 Aims Design strategy Greedy Algorithms correctness SingleSource Shortest Path o Weighted graph negative weight cycles 0 Definitions Weight of a path Shortestpath weight 0 Generalization of breadthfirst to weighted graph 0 Variants Singlesource Singledestination Singlepair Allpairs Relaxing an edge RELAX EL 1 m if dL xn dn with 1 then n r my uni 1 Irn 17 u H 39l39 Unmet U ham 9 dv upper bound on the weight of a shortest path from s to v Relaxation an operation that tightens an upper bound Dijkstra s algorithm DM HSIRAQ W E w 539 NH SINGLESGU39RCEIjFZ 5 3 131 Q r V L Lea insert HM vanities innitn Q while 52 Eli Lll39 H 1 EXTRACT Mmig 5 2 3 LJ Lt firr each vemex quotElF E Ac M an RELAJszfu u if if du 5 u 113qu 1 then My ac dLH wt 1 My r u Correctness of Dijkstra s algorithm Comparing BFSPrimDijkstra BFqu V E 5 or each n E V 5 am du 2 00 g lt 0 Q w EKQUEUH Q 5 while Q 2 lit u 1 DEQUEUEiQ ll each L39 E Ad u In if dv on than a u du 1 EXQUEUE I Q u 3 keylr lt 0 IN Q 1 d 10mm lt keth 4 11 3REASEKEYQ I U DIJKSWM V E m 5 INITS NGLESOURCE V s S 12 Q V I heq msen 3M ve iees while Q Hi an H lt EXTRACTMWQ S lt S U u fur each vane v E Adjht In RELAMM v u Greedy 0 Use min priority queue to find the ightest vertex outside S Dijkstra tree being grown Prim 0 Add this vertex to the set 0 Adjust the weights of the remaining vertices outside the set
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'