-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestBinHeap.C
More file actions
executable file
·54 lines (46 loc) · 1006 Bytes
/
TestBinHeap.C
File metadata and controls
executable file
·54 lines (46 loc) · 1006 Bytes
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
#include <iostream>
#include "BinNodeUtils.H"
using namespace std;
void printHeapPreorder(BinNode<int> * root)
{
if(root==NULL)
{
return;
}
cout<<root->getData()<<"-"<<root->getHeight()<<" ";
printHeapPreorder(root->getL());
printHeapPreorder(root->getR());
}
int main()
{
BinHeap<int> heap; //declaro un heap
//probamos el metodo de insertar
for(int i = 0;i < 10; i++)
{
//BinNode<int>* Node = new BinNode<int>(i);
//heap.insert(Node);
heap.insert(i);
}
//verificamos el metodo de buscar
BinNode<int>* aux = heap.search(3);
if(aux != NULL)
{
cout<<"El Nodo si se enuentra en el Arbol"<<endl;
}
aux = heap.remove(3);
if(aux != NULL)
{
delete aux;
cout<<"El Nodo si se removio del Arbol"<<endl;
}
//preorder(heap.getRoot()); //recorrido prefijo
preorder(heap);
cout<<endl;
//inorder(heap.getRoot()); //recorrido infijo
inorder(heap);
cout<<endl;
//postorder(heap.getRoot()); //recorrido postfijo
postorder(heap);
cout<<endl;
return 0;
}