-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAVLTree.h
47 lines (41 loc) · 943 Bytes
/
AVLTree.h
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
#ifndef AVLTREE_H
#define AVLTREE_H
#include <algorithm>
#include <fstream>
#include <iostream>
#include "EmployeeInfo.h"
typedef struct node {
EmployeeInfo empl;
node* left;
node* right;
int height;
} node;
class AVL {
node* root;
void makeEmpty(node* t);
node* insert(EmployeeInfo empl, node* t);
node* singleRightRotate(node*& t);
node* singleLeftRotate(node*& t);
node* doubleLeftRotate(node*& t);
node* doubleRightRotate(node*& t);
node* findMin(node* t);
node* findMax(node* t);
node* remove(int sin, node* t);
int height(node* t);
int getSizeRecursive(node *t);
int getBalance(node* t);
void inorder(node* t);
public:
AVL();
void insert(EmployeeInfo empl);
void remove(int sin);
void display();
node* GetRoot();
node* Find(node* node, int sin);
void clear();
node* findMinPublic();
node* findMaxPublic();
int getSize();
~AVL();
};
#endif // AVLTREE_H