This project implements and visualizes the Skyline Problem using C++ and C++ Builder.
The algorithm calculates the city skyline silhouette formed by the union of rectangular buildings, based on their (left x, height, right x) coordinates.
- Sweep line algorithm with O(n log n) time complexity
- Graphical visualization of buildings and skyline
- Dynamic input of buildings via mouse interaction
- Highlighted skyline points for better visual understanding
The project uses a sweep line approach:
- Each building generates two events — start and end.
- Events are sorted by x-coordinate.
- A multiset keeps track of active building heights.
- When the maximum height changes, a new skyline point is added.
- Time: O(n log n)
- Space: O(n)