60 likes | 277 Views
RAIK 283: Data Structures & Algorithms. Divide and Conquer (III)* Dr. Ying Lu ylu@cse.unl.edu. * slides referred to http://www.aw-bc.com/info/levitin. Divide and Conquer Example. Closest-pair problem Presentation Slides by Tsvika Klein . Divide and Conquer Example.
E N D
RAIK 283: Data Structures & Algorithms Divide and Conquer (III)* Dr. Ying Lu ylu@cse.unl.edu *slides referred to http://www.aw-bc.com/info/levitin Design and Analysis of Algorithms – Chapter 5
Divide and Conquer Example • Closest-pair problem • Presentation Slides by Tsvika Klein Design and Analysis of Algorithms – Chapter 5
Divide and Conquer Example • Convex-hull problem • Application Domain: • computer visualization, ray tracing, path finding in AI, GIS, visual pattern matching, verification methods, etc. Design and Analysis of Algorithms – Chapter 5
Divide and Conquer Example • Convex-hull problem • Presentation slides by JoãoComba Design and Analysis of Algorithms – Chapter 5
Pmax P2 P1 QuickHull Algorithm Inspired by Quicksort, it compute Convex Hull: • Identify extreme points P1 and P2 (part of hull) • Compute upper hull (Lower hull computation is similar): • find point Pmax that is farthest away from line P1P2 • compute the hull of the points to the left of line P1Pmax • compute the hull of the points to the left of line PmaxP2 Design and Analysis of Algorithms – Chapter 5
Efficiency of QuickHull algorithm • Finding point farthest away from line P1P2 can be done in linear time • This gives same efficiency as quicksort: • Worst case: Θ( n2) • Average case: Θ( n log n) • Other algorithms for convex hull: • Graham’s scan • DCHull also in Θ( n log n) Design and Analysis of Algorithms – Chapter 5