From 684eb03a874a7d001da5d8f4691aa04aa4ac6116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sat, 16 Apr 2022 17:33:27 +0200 Subject: [PATCH] add README --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..3efa80f --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +## Problem statement + +This solves the following problem: +``` +Given a set of rectilinear rectangles in the plane, each by coordinates of opposing corners, +calculate the area of their union. +``` +It was a task to show that this is solvable in `O(n^2)` on one of my exercise sheets. +Because I had some spare time, I decided to implement this. + +Actually, this can be done in `O(nlog n)` time using a sweepline algorithm +that makes use of [segment trees][st]. + +The implementation tries to be reasonably fast and respects `nlog n` running time, +but is certainly not too optimized and more of a showcase. + + +## Build +A standard `C++` installation along with `CMake` should to the job. +Remove the benchmark targets if you do not need them. + + +## Benchmark + +Just for fun, I played around with the [Google Benchmark Library][gl-benchmark]. +You will have to install the library and statically link to it to run the +benchmarks. +See the github page of the benchmark library for details. + + +[gl-benchmark]: https://github.com/google/benchmark +[st]: https://en.wikipedia.org/wiki/Segment_tree