-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAVL_test.cpp
More file actions
36 lines (35 loc) · 758 Bytes
/
AVL_test.cpp
File metadata and controls
36 lines (35 loc) · 758 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
/*
* AVL_test.cpp
*
* Created on: May 4, 2015
* Author: bassam
*/
#include "AVL.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
void print(Node<int>* node);
/******************************************************************************/
int main() {
Node<int> root = Node<int>(121);
AVL<int> avl = AVL<int>(&root);
avl.insert(1);
avl.insert(2);
avl.insert(23);
avl.insert(4);
avl.deleteNode(23);
avl.deleteNode(1);
avl.insert(41);
avl.insert(15);
avl.insert(51);
print(avl.getRoot());
return 0;
}
/******************************************************************************/
void print(Node<int>* node){
if(node) {
print(node->leftSon);
std::cout << "key = "<< node->key << "\n";
print(node->rightSon);
}
}