Note 12, DM819, fall 2018
Exercises December 3
- Exercises 15.1, 15.3, 15.5, 15.6.
- About the exam.
Lecture December 4
-
Foundations:
- Why do we like red-black trees as our base data structure for many problems?
- Despite of this, should we sometimes consider other data structures?
- Is Ω(n log n) a reasonable lower bound for our geometric problems, considering the modeling issues?
- What's the difference between sorting once and repeatedly finding the median?
- Is linear time heap building significantly better than just inserting all keys into a search tree?
Note 11, DM819, fall 2018
Exercises November 26
-
Exercises 14.5, 14.12, 14.13, 14.14.
In Exercise 14.12, assume the representation from Exercise 14.11.
In Exercise 14.13, what is the complexity if the tree is height balanced?
- In the balancing algorithm for quadtrees, which runs in O(dn), where n is the size of the tree, the O(d)-part is due to searches for neighbor nodes to check if they are more finely divided than the current node. Here, d denotes the height of the quadtree. Consider maintaining a constant amount of extra information in the internal nodes of a quadtree such that this information can be obtained in constant time, thereby reducing the time complexity of the balancing algorithm to O(n).
Lecture November 27
- Robot Motion Planning (sections 13.0-13.4).
- Visibility Graphs (chapter 15).
Note 10, DM819, fall 2018
Exercises November 19
- Exercises 12.3, 12.4, 12.5.
-
Given a set of n line segments, I1, ..., In,
a one-dimensional matryoshka is a subset
Ij1, ..., Ijk
such that Ij1 ⊂ Ij2, ...,
Ijk-1 ⊂ Ijk
and k is the size of the matryoshka.
- Design and analyze an algorithm for finding the size of the largest matryoshka.
- Define two-dimensional matryoshkas as a generalization of the above. Can you think of restrictions on input, similar to restrictions from the course, that would enable you to design an effective algorithm for this case?
-
A polygon path is the same as a polygon, except that the curve
can start and end at different vertices, i.e., it does not have to be closed.
As for polygons, we only consider paths that do not self-intersect.
Angles of 180° at vertices is allowed.
- Design and analyze an algorithm for computing a polygon path connecting n input points.
- Can any polygon path over n point be obtained from a polygon by removing an edge?
- Design and analyze an algorithm for computing a polygon connecting n input points.
-
A point q in the plane is dominated by a point p
if p.x ≥ q.x and p.y ≥ q.y.
A point from an input set of n points
is called dominating if it is not dominated by any other point.
The dominating set of a set of points S is the
set of all dominating points in S.
- Design a divide-and-conquer algorithm for computing the dominating set.
- Assume that somebody will provide a lexicographically sorted input set. Design a linear time algorithm for computing the dominating set.
-
Assume that we have n mice located under the x-axis
and n cheeses located above. You may assume that the mice
and cheeses are in general position.
We would like to assign one cheese to each mouse so that when
the mouse runs straight to its cheese, it will not bump into
another mouse, independent of their relative speeds.
- Does it work to sort both mice and cheeses on their x-coordinates and assign them pair-wise in that order?
- Design and analyze and algorithm that solves the problem in time O(n2).
- Make reasonable assumptions and show that this problem cannot be solved in time faster than Θ(n log n).
Lecture November 20
- Quadtrees (chapter 14).
Note 9, DM819, fall 2018
Exercises November 12
-
Exercises 10.2, 10.5, 10.6(a), 10.9, 10.10.
Exercises 10.2 and 10.5 are the hardest. So, also consider the other problems even if these first two problems cause you some difficulties. In 10.2, you do not need to build a priority search tree which looks exactly like the structure built using the normal construction method. You should just build something with the same asymptotic properties.
-
Preprocess a set S of n intervals
so that the following type of queries
can be answered efficiently. A query consists of an interval
qI = [qx:qy] and an element
qe∈qI.
One must report all intervals from S
that are contained in qI and contain
qe.
- Consider which problem arise if you want to make segment trees dynamic. It would be nice, for instance, if it was possible to (efficiently) insert an additional interval into the structure and then have the same guarantees on the search and report time after that. It is not presented as a dynamic structure in the textbook, so there will probably be a problem somewhere. Find it!
Lecture November 13
- Binary Space Partitions (section 12.0 - 12.3).
Note 8, DM819, fall 2018
Announcement
Note that there are no classes in this course in week 44 (October 29 and 30).This is an excellent opportunity to get a good start on part 2 of the project, so if you haven't made a contract already, I recommend that you see me as soon as possible such that you can work (extra) on it during week 44.
Exercises November 5
- Exercises 7.1, 7.2, 7.3, 7.5, 7.6, 7.10, 7.11.
- Also try to find a divide-and-conquer algorithm that solves 7.10, i.e., some approach that does not have anything to do with Voronoi diagrams.
Lecture November 6
- Segment Trees (section 10.3).
Note 7, DM819, fall 2018
Exercises October 22
- Exercises 6.2, 6.5, 6.7, 6.8, 6.16.
- Show that it must take at least the order of n log n to compute a trapezoidal map (some model assumptions are required to make this formal, but take that lightly). Hint: reduce from sorting.
- In Exercise 6.2, we considered bad worst-case situations. Consider the three complexity issues of search time, construction time, and storage space. To what extent is it possible to have good performance on some of these while at the same time having bad performance on others?
Lecture October 23
- Interval Trees and Priority Search Trees (sections 10.0 - 10.2).
Note 6, DM819, fall 2018
Exercises October 8
- Exercises 5.1, 5.3, 5.5 (ab), 5.8, 5.10, 5.13.
- Devise a method for building a red-black tree in linear time from a sorted sequence of n different keys. The tree should be external (also called leaf-oriented), i.e., all keys should be placed in the leaves and internal nodes hold copies of the keys directing searches to the correct locations. One potential difficulty in this problem is that not all trees have a form such that a red-black tree can be created by coloring nodes red or black.
Lecture October 9
- Voronoi Diagrams (sections 7.0 - 7.2).
Note 5, DM819, fall 2018
Exercises October 1
- Exercises 4.1, 4.2, 4.3, 4.15, 4.16.
- Show that RANDOMPERMUTATION generates all permutations with the same probability.
- Show that it must take at least the order of n log n to compute the intersection of n halfplanes (some model assumptions are required to make this formal, but take that lightly). Hint: reduce from sorting.
- From CLRS[1], for instance, we know that INSERTIONSORT uses n(n-1)/2 number of comparisons in the worst case. Use backwards analysis to show that if you randomize first (using RANDOMPERMUTATION), then the expected number of comparisons is n(n-1)/4.
Lecture October 2
- Point Location (sections 6.0 - 6.3).
- ^ Sections 2.1-2.2 of Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein. Introduction to Algorithms (third ed.). MIT Press, 2009. ISBN 978-0-262-03384-8.
Note 4, DM819, fall 2018
Exercises September 24
- Exercises 3.1, 3.2, 3.3, 3.6, 3.11, 3.13.
- Will algorithm MAKEMONOTONE divide a simple polygon up into the smallest number of y-monotone polygons possible? Prove that it does or find an example where it does not.
Lecture September 25
- Orthogonal Range Searching (chapter 5).
Note 3, DM819, fall 2018
Exercises September 17
- Exercises 2.1, 2.2, 2.3, 2.4, 2.14.
- Assume that we have n disjoint horizontal line segments and m disjoint vertical line segments. Give an O((m+n)log(m+n)) algorithm for finding the number of intersection points among the horizontal and vertical lines. Note that intersections point should not be reported; merely counted.
Lecture September 18
- Linear programming (sections 4.0 - 4.5).
Note 2, DM819, fall 2018
Exercises September 10
-
Exercises (1.1, 1.2,) 1.3, 1.4.a, 1.7, 1.8, 1.9.
Exercises 1.1 and 1.2 are about proving that the intersection of all convex sets containing P equals the smallest-perimeter polygon with vertices from P containing P. A better sequence of small proofs is the one below, which we will carry out instead of following the outline of Exercises 1.1 and 1.2. Prove that
- the intersection of a collection of convex sets is again convex.
- any smallest-perimeter polygon containing P has vertices only from P.
- any smallest-perimeter polygon containing P is convex.
- any smallest-perimeter polygon containing P is contained in any convex set containing P.
- any smallest-perimeter polygon with vertices from P equals the intersection of all convex sets containing P (making the polygon unique).
In 1.8.a, you may assume that the two convex hulls are separated by a vertical line.
Lecture September 11
- Polygon Triangulation (chapter 3).
Note 1, DM819, fall 2018
Lecture September 3
- Introduction to the course.
- Problems, goals, and methods of the area (chapter 1).
- Convex hull in the plane (chapter 1).
- Euler's theorem of planar graphs.
Lecture September 4
- Line Segment Intersection (sections 2.0 - 2.1).