Files
Data-Structure/BinaryTree/priorityQueue/maxWBLT/main.cpp
e2hang 3c33c80a72 WBLT
2025-08-10 23:24:21 +08:00

34 lines
636 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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
*/