Files
Data-Structure/BinaryTree/tournamentTree/WinnerTree/main.cpp
2025-08-11 14:39:57 +08:00

41 lines
660 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 "winnerTree.h"
using namespace std;
int main() {
//输入的时候d反转一下好像没必要哈
deque<int> q;
q.push_back(1);
q.push_back(2);
q.push_back(3);
q.push_back(4);
q.push_back(5);
q.push_back(6);
q.push_back(7);
q.push_back(8);
q.push_back(9);
q.push_back(10);
winnerTree<int> t(q, 10);
t.init();
cout << t.winner() << endl;
t.display();
cout << endl;
t.replay(6, 11);
cout << t.winner() << endl;
t.display();
return 0;
}
/*
非常正确的竞赛树
10
10
10 8
4 10 8 6
4 2 10 9 8 7 6 5
4 3 2 1
11
11
10 11
4 10 8 11
4 2 10 9 8 7 11 5
4 3 2 1
*/