A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. In this assignment, buildings are assumed to be rectangular and represented by an ordered-triple of integers, 〈??, ℎ, ??〉 where ?? denotes the x-coordinate of the left side of a building (along the x axis), ℎ denotes its height (along the y axis) and ?? denotes the right side of a building (along the x axis). The x axis is assumed to start at 0.
The problem in this assignment is transform a specification of a collection of buildings to a specification of its implied skyline. The input building specification is a collection of ordered triples, such as,
The output consists of successive left endpoints of a vertical line segment, where to start on the x
axis and how high up to go
To visualize the problem, the input specification given above would be pictured as on the left
and the output would be pictured as on the right:
Get Free Quote!
334 Experts Online