This commit is contained in:
e2hang
2025-08-10 23:24:21 +08:00
parent 023973b5a1
commit 3c33c80a72
4 changed files with 189 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
#include "maxWBLT.h"
int main() {
/*
Tree1
50
/ \
40 30
/ \
20 10
Tree2
45
/ \
35 25
/ \
15 5
*/
maxWBLT<int> t1,t2;
t1.push(50);t1.push(30);t1.push(40);t1.push(20);t1.push(10);
t2.push(45);t2.push(25);t2.push(35);t2.push(15);t2.push(5);
t1.display();
t2.display();
//正确的树
t1.meld(t2);
t1.display();
return 0;
}
/*
最后输出了
{5, 50}, {2, 40}, {2, 30}, {1, 20}, {1, 10},
{5, 45}, {2, 35}, {2, 25}, {1, 15}, {1, 5},
{10, 50}, {7, 45}, {2, 40}, {4, 30}, {2, 35}, {1, 20}, {2, 25}, {1, 10}, {1, 15}, {1, 5},
与预测一致详情见README.MD
*/