Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
homework I problems
Problem 1: Skylines
In a video game, a city’s buildings are rectangles along an axis, specified as Bi = (si , fi , hi ), for
1 ≤ i ≤ n, for a building starting at x = si and going to x = fi at height hi . When seen from a
distance, the graphics is supposed to plot the skyline, which at each vertical point x has height the
height of the tallest building Bi with si ≤ x ≤ fi . Give an algorithm to plot the skyline, as a series
of points connected by line segments. Assume n is a power of 2.