dont copy node data in tree delete operation - just swap nodes

This commit is contained in:
IlyaShurupov 2024-04-01 16:51:58 +03:00
parent 6148ff15d2
commit 738ce1d914
3 changed files with 98 additions and 45 deletions

View file

@ -1,16 +0,0 @@
#include "Tree.hpp"
#include "Timing.hpp"
#include "UnitTest++/UnitTest++.h"
#include <map>
TEST(AVLTreeStream) {
tp::Timer timer(1000);
tp::AvlTree<tp::AvlNumericKey<tp::ualni>> tree;
while (!timer.isTimeout()) {
tree.
}
}

View file

@ -24,7 +24,7 @@ SUITE(AvlTree) {
TEST(Persistance) {
AvlTree<AvlNumericKey<alni>, TestClass, TestAllocator> tree;
const auto size = 1000;
const auto size = 10;
struct Item {
Item() :
@ -87,6 +87,8 @@ SUITE(AvlTree) {
tree.remove((alni) buff[idx].data.getVal());
CHECK(tree.isValid());
unloadSize++;
buff[idx].presents = false;
@ -120,5 +122,4 @@ SUITE(AvlTree) {
CHECK(tree.maxNode(tree.head()) == nullptr);
CHECK(tree.minNode(tree.head()) == nullptr);
}
}