41#include <gtest/gtest.h>
46using namespace testing;
55 for (
size_t i = 0; i < arr.
size(); ++i)
56 out.push_back(arr[i]);
61 std::vector<typename Tree::key_type>
to_vector(
const Tree & tree)
70 const std::vector<int>
ref_keys(ref.begin(), ref.end());
71 const auto min_key = tree.min_key();
72 const auto max_key = tree.max_key();
125 std::vector<int> src = {8, 3, 5, 8, 2, 9, 1};
137 for (
int value : {40, 10, 90, 20, 70, 60, 30, 50, 80})
164 for (
int i = 1; i <= 40; ++i)
170 for (
int value : {1, 2, 3, 7, 8, 9, 16, 17, 18, 25, 26, 27, 40, 31, 24, 12})
184 Tree tree = {50, 20, 70, 10, 30, 60, 80};
209 std::mt19937
rng(0xBADA55);
210 std::uniform_int_distribution<int>
op_dist(0, 5);
211 std::uniform_int_distribution<int>
value_dist(-50, 150);
213 for (
size_t step = 0; step < 1200; ++step)
235 const auto it = ref.lower_bound(
value);
237 it == ref.end() ? std::nullopt : std::optional<int>(*it);
244 const auto it = ref.upper_bound(
value);
246 it == ref.end() ? std::nullopt : std::optional<int>(*it);
TEST_F(BTreeTest, EmptyTreeReportsNoKeys)
size_t size_t int32_t value
size_t size_t int32_t * out
Simple dynamic array with automatic resizing and functional operations.
constexpr size_t size() const noexcept
Return the number of elements stored in the stack.
Generic B-Tree with configurable minimum degree.
Minimal std::expected-style result type for C++20.
constexpr bool has_value() const noexcept
Check if a value is held.
QuadTree - Hierarchical spatial index for 2D points.
void empty(Node *&r) noexcept
Recursively delete all nodes.
void remove(const Point &p)
Remove a point from the tree.
Point * search(const Point &p) noexcept
Search for a point in the tree.
bool contains(const Point &p) const noexcept
Check if a point is within the tree's region.
Point * insert(Node *&r, const Point &p)
Recursive insert helper.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
Itor2 copy(Itor1 sourceBeg, const Itor1 &sourceEnd, Itor2 destBeg)
Copy elements from one range to another.
std::vector< typename C::Item_Type > to_vector(const C &c)
Convert a container to a std::vector.
B-Tree implementation with configurable minimum degree.