-
Notifications
You must be signed in to change notification settings - Fork 0
/
6-03-elementominimoarbol.cpp
67 lines (56 loc) · 1.06 KB
/
6-03-elementominimoarbol.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Nuria Bango Iglesias
// VJ04
#include <iostream>
#include <iomanip>
#include <fstream>
#include "bintree_eda.h"
using namespace std;
// METODO 1: OPERACION INTERNA
template <class T>
class tree_plus : public bintree<T> {
using Link = typename bintree<T>::Link;
public:
T getElemMinimo() const {
return getElemMinimo(this->raiz);
}
private:
static T getElemMinimo(Link raiz) {
return 0;
}
};
// METODO 2: OPERACION EXTERNA
template <class T>
T elemMinimo(bintree<T> const& tree) {
T solucion
if (tree.empty())
;
else
;
return solucion;
}
void resuelveCaso() {
// metodo 1
tree_plus<int> tree_plus;
(bintree<int>)tree_plus = leerArbol(-1);
cout << tree_plus.getElemMinimo() << "\n";
// metodo 2
/*
bintree<int> tree;
tree = leerArbol(-1);
cout << elemMinimo(tree) << "\n";
*/
}
int main() {
#ifndef DOMJUDGE
std::ifstream in("datos.txt");
auto cinbuf = std::cin.rdbuf(in.rdbuf());
#endif
int numCasos;
std::cin >> numCasos;
for (int i = 0; i < numCasos; ++i)
resuelveCaso();
#ifndef DOMJUDGE
std::cin.rdbuf(cinbuf);
#endif
return 0;
}