Skip to content

Brevex/Binary-Search-Tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

66 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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.


โš ๏ธ The program will only recognize the test file if it is named "testFile.txt"

โš ๏ธ 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


Skills


๐Ÿ’ก 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 -

About

A binary search tree made in Java that manipulates integer values.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages