Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brevex/binary-search-tree
A binary search tree made in Java that manipulates integer values.
https://github.com/brevex/binary-search-tree
algorithm binary-search-tree computer-science data-structures java
Last synced: 22 days ago
JSON representation
A binary search tree made in Java that manipulates integer values.
- Host: GitHub
- URL: https://github.com/brevex/binary-search-tree
- Owner: Brevex
- Created: 2023-10-30T23:21:33.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-19T22:21:55.000Z (about 1 year ago)
- Last Synced: 2023-11-20T00:10:46.657Z (about 1 year ago)
- Topics: algorithm, binary-search-tree, computer-science, data-structures, java
- Language: Java
- Homepage:
- Size: 454 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Java Binary Search Tree
🔍 About the project
A binary search tree made in Java that manipulates integer values. In addition to
conventional insertion, removal and search operations, the tree also has additional
methods for better analysis of the structure.
🔨 Dependencies and Execution
- Download JDK by clicking here.
- Configure JDK on your machine.
- Download this project and open the terminal inside the
src
folder.
- With the terminal open, run in sequence the following commands:
javac TreeProgram.java
java TreeProgram
📄 Test File
The program has a test file. Inside the
src
folder you will find a file calledtestFile.txt
, in
it you can write one command per line so that the program starts and executes each command
automatically without the need to enter the commands manually.
> :warning: **The program will only recognize the test file if it is named "testFile.txt"**
> :warning: **The file must be in thesrc
folder**
Test File Exemple
Create a
testFile.txt
file with the lines below
insert 22
insert 16
insert 24
insert 33
complete
full
nth 3
insert 36
full
preorder
remove 50
insert 15
insert 39
remove 32
position 15
insert 39
nth 5
median
mean 20
search 36
insert 25
median
print 1
print 2
🔮 Technologies Used
💡 Program Functions
As mentioned, the program has several other functions in addition to the basic insertion, removal and
search. the program works either by manually receiving the functions or with a test file, below are the available functions:
insert
Adds a new element to the tree
remove
Removes a element from the tree
Allows the user to print the tree in 2 different styles
nth
Search for the element corresponding to the position passed in the command parameter
position
Returns the position of the element inserted in the command parameter
median
Returns the element that occupies the median of the tree
mean
Returns the arithmetic mean of tree values
full
Analyzes whether the tree is full or not
complete
Analyzes whether the tree is complete or not
preorder
Print the tree in preorder
complete
Searches for an element in the tree and returns whether it exists or not
- By Breno -