MIT6_851S10_assn02_sol

# MIT6_851S10_assn02_sol - Also we can just project the...

This preview shows pages 1–2. Sign up to view the full content.

6.851 Advanced Data Structures (Spring’10) Prof. Erik Demaine Dr. Andr´ e Schulz TA: Aleksandar Zlateski Problem 2 Sample Solutions Query Time for kd -trees. Let’s consider an intersections along one edge, either vertical or horizontal, and the next intersection (horizontal or vertical). Note that the number of regions doubles after two levels of intersections, hence the depth of the kd -tree is d = log 2 n . Summing up all the intersections at all depths we get that the total number of regions intersected is O ( n ). For the part 2, we can just arrange the points on the n by n lattace. Segment Stabbing Note that there is no limit on the memory used. Therefore we can just use a midified segment tree.

This preview has intentionally blurred sections. Sign up to view the full version.

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

Unformatted text preview: Also, we can just project the points to the x axis and for each obtained interval (at most n 2 of them, in the case of intersecting points) we store all the intersecting segments sorted by the y coordinate. This way we can answer both queries in O ( k + log n 2 ) = O ( k + log n ). 1 MIT OpenCourseWare http://ocw.mit.edu 6.851 Advanced Data Structures Spring 2010 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms ....
View Full Document

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern