https://github.com/anniedotexe/binarysearchtree
https://github.com/anniedotexe/binarysearchtree
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/anniedotexe/binarysearchtree
- Owner: anniedotexe
- Created: 2018-05-20T20:43:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-16T04:04:04.000Z (about 6 years ago)
- Last Synced: 2025-03-14T01:47:11.976Z (7 months ago)
- Language: Java
- Size: 33.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Binary Search Tree
The user will be prompted to enter a sequence of values separated by spaces.The commands the user can call are:
The commands need to be called with a value after it.
#### Sample Output
```
Please enter the initial sequence of values:
51 40 21 38 32 8 27 9 28 36 3 48 13 44
51 has been inserted into the binary search tree.
40 has been inserted into the binary search tree.
21 has been inserted into the binary search tree.
38 has been inserted into the binary search tree.
32 has been inserted into the binary search tree.
8 has been inserted into the binary search tree.
27 has been inserted into the binary search tree.
9 has been inserted into the binary search tree.
28 has been inserted into the binary search tree.
36 has been inserted into the binary search tree.
3 has been inserted into the binary search tree.
48 has been inserted into the binary search tree.
13 has been inserted into the binary search tree.
44 has been inserted into the binary search tree.
Preorder: 51 40 21 8 3 9 13 38 32 27 28 36 48 44
Inorder: 3 8 9 13 21 27 28 32 36 38 40 44 48 51
Postorder: 3 13 9 8 28 27 36 32 38 21 44 48 40 51
I. Insert a value
D. Delete a value
P. Find predecessor
S. Find successor
E. Exit the program
H. Display this message
Command? i 39
39 has been inserted into the binary search tree.
Inorder: 3 8 9 13 21 27 28 32 36 38 39 40 44 48 51
Command? d 24
24 does not exist in the binary search tree.
Inorder: 3 8 9 13 21 27 28 32 36 38 39 40 44 48 51
Command? d 27
27 has been deleted from the binary search tree.
Inorder: 3 8 9 13 21 28 32 36 38 39 40 44 48 51
Command? p 44
The predecessor is 40
Command? s 44
The successor is 48
Command? h
I. Insert a value
D. Delete a value
P. Find predecessor
S. Find successor
E. Exit the program
H. Display this message
Command? e
Thank you for using my program!
```