The Skyline Problem
Автор: IDeserve
Загружено: 2015-08-25
Просмотров: 39752
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are given the locations and height of all the buildings, write a program to output the skyline formed by these buildings collectively. The skyline would be returned as a set of key points.
Algorithm in short -
1. Compare key points of skylines starting from leftmost end.
Choose the one having lesser of ‘x’ value.
2. If ‘y’ value of chosen key point is less than last seen height of other skyline, update key point’s ‘y’ to last seen height of other skyline.
3. Proceed to next key point of the chosen skyline.
4. Repeat above steps till both the skylines are completed.
5. Remove the redundant key points.
Website: http://www.ideserve.co.in
Facebook: / ideserve.co.in
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: