some code experiments
This commit is contained in:
45
tmp/main.cpp
Normal file
45
tmp/main.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <iostream>
|
||||
#include "bTree.h"
|
||||
|
||||
bool compare(int a, int b) {
|
||||
return a < b;
|
||||
};
|
||||
|
||||
void print(int a) {
|
||||
std::cout << a << std::endl;
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
BTree<int> bt(4, compare, print);
|
||||
|
||||
bt.insert(1);
|
||||
bt.insert(2);
|
||||
bt.insert(3);
|
||||
bt.insert(3);
|
||||
bt.insert(3);
|
||||
bt.insert(3);
|
||||
bt.insert(3);
|
||||
bt.insert(3);
|
||||
bt.insert(3);
|
||||
bt.insert(3);
|
||||
bt.insert(4);
|
||||
bt.insert(5);
|
||||
bt.insert(6);
|
||||
bt.insert(7);
|
||||
bt.insert(7);
|
||||
bt.insert(7);
|
||||
bt.insert(7);
|
||||
bt.insert(7);
|
||||
|
||||
|
||||
|
||||
bt.print();
|
||||
|
||||
auto r = bt.search(7);
|
||||
auto r1 = bt.searchKey(3);
|
||||
auto r2 = bt.remove(2);
|
||||
auto r3 = bt.search(2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user