forked from xnkasy/Assignment123COL106Public
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAVLTree.java
More file actions
60 lines (46 loc) · 1.5 KB
/
AVLTree.java
File metadata and controls
60 lines (46 loc) · 1.5 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
// Class: Height balanced AVL Tree
// Binary Search Tree
public class AVLTree extends BSTree {
private AVLTree left, right; // Children.
private AVLTree parent; // Parent pointer.
private int height; // The height of the subtree
public AVLTree() {
super();
// This acts as a sentinel root node
// How to identify a sentinel node: A node with parent == null is SENTINEL NODE
// The actual tree starts from one of the child of the sentinel node !.
// CONVENTION: Assume right child of the sentinel node holds the actual root! and left child will always be null.
}
public AVLTree(int address, int size, int key) {
super(address, size, key);
this.height = 0;
}
// Implement the following functions for AVL Trees.
// You need not implement all the functions.
// Some of the functions may be directly inherited from the BSTree class and nothing needs to be done for those.
// Remove the functions, to not override the inherited functions.
public AVLTree Insert(int address, int size, int key)
{
return null;
}
public boolean Delete(Dictionary e)
{
return false;
}
public AVLTree Find(int k, boolean exact)
{
return null;
}
public AVLTree getFirst()
{
return null;
}
public AVLTree getNext()
{
return null;
}
public boolean sanity()
{
return false;
}
}