Skip to content
DJTojiMiko edited this page Dec 11, 2020 · 2 revisions

Binary Search Tree Program by Abel Gonzalez

Goal of the program

The goal of the program is to take any random amount of numbers, be able to sort them, and add insert them into a binary search tree data structure.

How does this program do this?

The program creates a class BSTree, the tree, which is comprised of a smaller class BSTreeNode. Whenever a number is input, a new node is made with the value of the input. The node then goes through a binary comparison algorithm to determine where in the tree the node will be placed. The program also has a print function implemented to print out an archaic version of what the graph would look like, showing nodes connected to each other as their values with two hyphens in between on a line and singular nodes as just the value on the printed line.

Instructions

Prerequisites

  • Most current version of a g++/MinGW compiler installed and setup
  • If on a Windows machine, recommended to use recent build of Ubuntu

Compiling Program

  1. On Terminal(Mac/Linux) or Ubuntu(Windows), navigate to directory of code
  2. Type 'make' and hit 'Enter'

Ubuntu of make command

Running Program

  1. After compiling the program, type './output'
  2. Program will run

Program running