tut2_ppt - COMP271H COMP271H Tutorial 2 Maximal points...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COMP271H COMP271H Tutorial 2 Maximal points problem Question – Math meaning Question Question – Geometric meaning Question y-axis A point set S This is the maximal point among points in S x-axis Define some terms Define Q2 P Q3 Q4 Q Term 2: Q is invalidated by P QI P Term 1: Four areas Q1~Q4 Terms: P iis a maximal point if no other points lying in s Q1 Q1 If P is inside Q1 of Q, then Q is invalidated by If P How to tackle this problem? How Brute force For each point p, we check with all other For points. If p is not invalidated by any other point, then If report p as maximal point report • Running time = O(N^2) Divide-and-conquer How to divide? How to conquer? How How to combine? (Most important!!) First thing to do First We first sort all points according to their x- coordinates Reason? Easier to divide points into two sets Sorting only takes O(nlogn) Do only once, at the very beginning Partial solutions look like….? Partial Observations Observations Assume two partial solutions are Assume sorted by increasing x-coordinates sorted The partial solutions should be in The decreasing order of y-coordinates decreasing Reason: If not, there is only a single Reason: item in the list item Impossible!! All points from the right list must All also appear in the combined solution solution Combine step Combine First thing to do Drops out maximal points (which are no Drops longer maximal in the combined solution) from the left partial solution the Ensures the combined solution is sorted in Ensures increasing x-coordinates increasing Second thing to do My solution My Further discussion Further Suppose we know in advance, there are Suppose only constant number of maximal points in our solution. Can we design a better algorithm to solve the problem? algorithm In our divide-and-conquer algorithm, no In matter how many maximal points are, we still need O(nlogn) time need How to devise a new algorithm to do the job? Q&A Any other questions? ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern