HBLT
This commit is contained in:
34
BinaryTree/priorityQueue/maxHBLT/main.cpp
Normal file
34
BinaryTree/priorityQueue/maxHBLT/main.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "maxHblt.h"
|
||||
|
||||
int main() {
|
||||
/*
|
||||
Tree1
|
||||
50
|
||||
/ \
|
||||
40 30
|
||||
/ \
|
||||
20 10
|
||||
Tree2
|
||||
45
|
||||
/ \
|
||||
35 25
|
||||
/ \
|
||||
15 5
|
||||
*/
|
||||
maxHblt<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;
|
||||
}
|
||||
/*
|
||||
最后输出了
|
||||
{2, 50}, {2, 40}, {1, 30}, {1, 20}, {1, 10},
|
||||
{2, 45}, {2, 35}, {1, 25}, {1, 15}, {1, 5},
|
||||
{3, 50}, {2, 40}, {2, 45}, {1, 20}, {1, 10}, {2, 35}, {1, 30}, {1, 15}, {1, 5}, {1, 25},
|
||||
与预测一致,详情见README.MD
|
||||
*/
|
Reference in New Issue
Block a user