evelynnkaplan / tree-practice

A repository created to practice writing Binary Search tree methods

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tree Exercise

This project is due Monday September 2nd, 2019

In this exercise you will implement, in Ruby, several Tree methods.

  • add(value) - This method adds a value to the Binary Search Tree
  • find(value) - This method returns true if the given value is in the tree and false otherwise.
  • inorder - This method returns an array of all the elements in the tree, in order.
  • postorder - This method returns an array of all the elements in a postorder fashion (left, right , root).
  • preorder - This method returns an array of all the elements in a preorder fashion (root, left, right).
  • height - This method returns the height of the binary search tree.

Optionals

  • delete(value) - This method removes a node from the tree. Also add tests for the method.
  • bfs - This method returns an array with the tree elements in a level-by-level order (see Breadth-First traversal)

About

A repository created to practice writing Binary Search tree methods


Languages

Language:Ruby 100.0%