Write a binary tree class : Java Programming Help

Goals for this Lab

  1. Write a binary tree class.


Task Description

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



The BinaryTree Class

The public constructors and methods required for the BinaryTree 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 toString() 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.

Contact Us

Tel: (+91) 0120  4118730  

Time :   10 : 00  AM -  08 : 00 PM IST 

Registered address: G-69, Sector 63, 

 Noida - 201301, India

We Provide Services Across The different countries

USA    Australia   Canada   UK    UAE    Singapore   New Zealand    Malasia   India   Ireland   Germany

CodersArts is a Product by Sofstack Technology Solutions Pvt. Ltd.

  • CodersArts | Linkedin
  • Instagram