diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 01:24:14 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 01:24:14 +0100 |
| commit | 98567ec798aa8ca2cfbcb85c774dd470f30e30d4 (patch) | |
| tree | 5113d5cc24d1ad5f93810b6442ce584a36950dc8 /datastructures/test/fenwickTree.cpp | |
| parent | ad3856a6b766087df0036de0b556f4700a6498c9 (diff) | |
| parent | 8d11c6c8213f46f0fa19826917c255edd5d43cb1 (diff) | |
mzuenni tests
Diffstat (limited to 'datastructures/test/fenwickTree.cpp')
| -rw-r--r-- | datastructures/test/fenwickTree.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/datastructures/test/fenwickTree.cpp b/datastructures/test/fenwickTree.cpp deleted file mode 100644 index f9dd619..0000000 --- a/datastructures/test/fenwickTree.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "../fenwickTree.cpp" - -void test(int n) { - vector<ll> naive(n); - init(n); - - for (int i = 0; i < 1000; i++) { - int p = util::randint(n); - ll delta = util::randint(); - update(p, delta); - naive[p] += delta; - - int r = util::randint(n+1); - - ll naive_result = 0; - for (int i = 0; i < r; i++) naive_result += naive[i]; - ll fenwick_result = prefix_sum(r); - assert(naive_result == fenwick_result); - } -} - -int main() { - test(1); - test(100); - test(1000); -} |
