top of page

Write a binary tree class : Java Programming Help

Updated: Mar 23, 2021

Goals for this Lab

  1. Write a binary tree class.


Task Description

Your goal for this lab is to write a binary tree.



The Binary Tree Class


The public constructors and methods required for the Binary Tree class are listed here. For this lab the tree will only need to handle integers.

  • BinaryTree(): Construct an empty BinaryTree object.

  • int size(): Return the size (number of items) in this BinaryTree.

  • boolean isEmpty(): Return true if this BinaryTree has no items. (This is the same as the size equal to zero.) Return false if the size is greater than zero.

  • void add(int value): Add the given element, value, to the tree.

  • bool exists(int value): Return true if the element exists in the tree, otherwise return false.

  • Integer max(): Return the largest element in the tree.

  • Integer min(): Return the smallest element in the tree.


Requirements

  1. Your class must be named BinaryTree.

  2. Your class must provide the methods listed above for construction, accessing, and manipulating BinaryTree objects.

  3. Other than for testing purposes, your BinaryTree class should do no input or output.


Testing


This lab will be manually tested. Make sure to test all cases.


Notes


It may be useful to be able to print out the tree during development/debugging. This will be easiest by creating a to String() method for your BinaryTree class, but it is not required.


Contact us for Hire Java developers, Java programming help, Java Coding work, Java Expert for your Project, Java Homework Help, Java Course work Help, Java Tutor,  and for your business work. If you like Codersarts blog and looking for Assignment help,Project help, Programming tutors help and suggestion  you can send mail at codersarts@gmail.com.


Comments


bottom of page