Design and Analysis of Algorithms – Chapter 51 Divide and Conquer (III)* Dr. Ying Lu RAIK 283: Data Structures & Algorithms *slides referred tohttp://
Design and Analysis of Algorithms – Chapter 52 Divide and Conquer Example b Closest-pair problem Presentation Slides by Tsvika KleinPresentation Slides by Tsvika KleinPresentation SlidesTsvika KleinPresentation SlidesTsvika Klein
Design and Analysis of Algorithms – Chapter 53 Divide and Conquer Example b Convex-hull problem b Application Domain: bcomputer visualization, ray tracing, path finding in AI, GIS, visual pattern matching, verification methods, etc.
Design and Analysis of Algorithms – Chapter 54 Divide and Conquer Example b Convex-hull problem Presentation slides by João CombaPresentation slides by João CombaPresentation slides João CombaPresentation slides João Comba
Design and Analysis of Algorithms – Chapter 55 QuickHull Algorithm Inspired by Quicksort, it compute Convex Hull: b Identify extreme points P 1 and P 2 (part of hull) b Compute upper hull (Lower hull computation is similar): find point P max that is farthest away from line P 1 P 2find point P max that is farthest away from line P 1 P 2 compute the hull of the points to the left of line P 1 P maxcompute the hull of the points to the left of line P 1 P max compute the hull of the points to the left of line P max P 2compute the hull of the points to the left of line P max P 2 P1P1 P2P2 P max
Design and Analysis of Algorithms – Chapter 56 Efficiency of QuickHull algorithm b Finding point farthest away from line P 1 P 2 can be done in linear time b This gives same efficiency as quicksort: Worst case: Θ( n 2 )Worst case: Θ( n 2 ) Average case: Θ( n log n)Average case: Θ( n log n) b Other algorithms for convex hull: Graham’s scanGraham’s scan DCHullDCHull also in Θ( n log n)