Skip to content

gradimbuyi/TwoFourTree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TwoFourTree

This is a small implementiation of a 2-3-4 tree, or a B-Tree with a max degree of 4. The program takes in integer values that are provided by Dr. Matthew Gerber through his test harness (App.java). This implemention is built for educational purposess and shouldn't be used in any meaningful program. Java, through Oracle, provides programmers with better performing trees. However, learning how this data structure is built gives us the foundation to understand more complex trees.

Compiling the Program

$ javac ./src/App.java

Executing the Program

$ java ./App 

Relevant Methods


Searches value by recursively traversing the tree until it reaches the appropriate level. It returns the level in which our value is expected to be, and with the help of the inTree() method, we're able to determine wether our value is in our tree.

 private TwoFourTreeItem search(int value)

Calls private internal method and adds a value by recursively traversing the tree until it reaches the appropriate level. This operation is done through the search method, which returns the location in which our value should be added or the location where our value already exists. If the value is in the tree, we do not add it.

public boolean addValue(int value) 

Academic Integrity Statement

I, Gradi Tshielekeja Mbuyi, affirm that this program is entirely my own work and that I have neither developed my code together with any other person, nor copied any code from any other person, nor permitted my code to be copied or otherwise used by any other person, nor have I copied, modified, or otherwise used programs created by others. I acknowledge that any violation of the above terms will be treated as academic dishonesty.

About

An implementation of a 2-3-4 Tree accepting integers as inputs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages