-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary.h
More file actions
88 lines (74 loc) · 1.98 KB
/
library.h
File metadata and controls
88 lines (74 loc) · 1.98 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//#ifndef LIBRARY_H
//#define LIBRARY_H
//
//#include <graphics.h>
//
//// Binary Search Tree (BST) Node
//struct BSTNode {
// int data;
// BSTNode* left;
// BSTNode* right;
//};
//
//// AVL Tree Node
//struct AVLNode {
// int data;
// AVLNode* left;
// AVLNode* right;
// int height;
//};
//
//// Function Prototypes
//
//// BST Functions
//BSTNode* insertBSTNode(BSTNode* root, int data);
//void displayBST(BSTNode* root, int x, int y, int offset);
//
//// AVL Tree Functions
//AVLNode* insertAVLNode(AVLNode* root, int data);
//int getHeight(AVLNode* node);
//int getBalanceFactor(AVLNode* node);
//AVLNode* rotateRight(AVLNode* y);
//AVLNode* rotateLeft(AVLNode* x);
//void displayAVL(AVLNode* root, int x, int y, int offset);
//
//// Heap Functions
//void heapSort(int heap[], int size);
//void displayHeap(int heap[], int size, int x, int y, int offset);
//
//// Utility Functions
//void initializeGraphics();
//void clearScreen();
//void autoDisplay(BSTNode* bstRoot, AVLNode* avlRoot, int heap[], int heapSize);
//
//#endif
#ifndef LIBRARY_H
#define LIBRARY_H
#include <graphics.h>
#include <iostream>
struct BSTNode {
int data;
BSTNode* left;
BSTNode* right;
};
struct AVLNode {
int data;
AVLNode* left;
AVLNode* right;
int height;
};
BSTNode* insertBSTNode(BSTNode* root, int data);
void displayBST(BSTNode* root, int x, int y, int offset);
int getHeight(AVLNode* node);
int getBalanceFactor(AVLNode* node);
AVLNode* rotateRight(AVLNode* y);
AVLNode* rotateLeft(AVLNode* x);
AVLNode* insertAVLNode(AVLNode* root, int data);
void displayAVL(AVLNode* root, int x, int y, int offset);
void heapify(int heap[], int size, int i);
void heapSort(int heap[], int size);
void displayHeap(int heap[], int size, int x, int y, int offset);
void initializeGraphics();
void clearScreen();
void autoDisplay(BSTNode* bstRoot, AVLNode* avlRoot, int heap[], int heapSize);
#endif