34 lines
636 B
C++
34 lines
636 B
C++
#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
|
||
*/ |