Platform: Linux
Software Requirement
- Python version 2.7
- To install python :
sudo apt-get install python2.7 python-pip
- To install python :
- G++ compiler
- To install G++ :
sudo apt-get install g++
- To install G++ :
- Matplotlib library for graph
- To install Matplot library :
pip install matplotlib
- To install Matplot library :
- To compile splay tree and AVL tree
g++ splay.cpp –o splay
g++ avl.cpp –o avl
- To Run splay tree and AVL tree
./splay
./avl
- Go to test folder
- Run test file
python test.py
- If you want to test splay tree implementation, there are some test case for it. For that you have to run test.py.
- Go to graph folder
- Run script file
python script.py
- If you want depth graphical analysis of splay tree and AVL tree, then run script.py .It will generate graph for each operation. Graph shows time taken for each operation.
- Insert :
Function Definition:void insertnode(long long key)
Description: Insert function takes one integer argument and insert it into the tree. If key is already present then it will show appropriate message. - Delete :
Function Definition:bool deletenode(long long key)
Description: Delete function takes one integer argument and delete if from tree if it exists. Otherwise it shows error message. If element deleted successfully then it will return true, else return false. - Search :
Function Definition:bool search(long long key)
Description: Search function takes one integer argument and search that key in the tree and show appropriate message. If key found in the tree then it will return true, else return false. - Tree Traversal :
Function Definition:void inorder(struct node *root)
Description: Inorder function takes root of the tree as argument and print inorder traversal of the tree.