skyline
Version:
Divide and conquer algorithm to solve "The Skyline Problem".
66 lines (47 loc) • 1 kB
Markdown
> Divide and conquer algorithm to solve "[The Skyline Problem](http://www.algorithmist.com/index.php/UVa_105)".
[](https://lab.miguelmota.com/skyline)
[](https://lab.miguelmota.com/skyline)
```bash
npm install skyline
```
Input is a squence of building triples: *left x-coordinate*, *height y-coordinate*, *right x-coordinate*.
Output is a sequence of skyline tuples: *left x-coordinate*, *height y-coordinate*.
```javascript
const skyline = require('flowright');
const buildings = [
[],
[],
[],
[],
[],
[],
[],
[]
];
var skylinePoints = skyline(buildings);
console.log(skylinePoints);
//
[
[],
[],
[],
[],
[],
[],
[],
[],
[]
]
```
```bash
npm test
```
[](https://ideone.com/tP0aIo)
MIT