Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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


  1. Download JDK by clicking here.

  2. Configure JDK on your machine.

  3. Download this project and open the terminal inside the src folder.

  4. 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 called testFile.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 the src 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


print

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 -