Implement the binarysearchtree class

Assignment Help Basic Computer Science
Reference no: EM131963250

Please assist me on this assignment. Implement the BinarySearchTree class. The BinarySearchTree class extends the BinaryTree class which implements the Tree interface. Please see the codes below. Implement all of the abstract methods of the BinaryTree class recursively. Include the main method for the BinarySearchTree class, use recursion in the code and make sure the code produces the correct output.

They are:

  • Insert
  • Iterator (non-recursive)
  • Remove.
  • Search.

Also, implement an Iterator inner class for the BinarySearchTree class. Make sure to have a modified BinarySearchTree.java file with your source code. Do not submit and do not modify the Tree.java or BinaryTree.java files.

/*
 *
 *  Tree.java
 *
 */

public interface Tree<E> extends Iterable<E> {
    void insert(E data);
    void remove(E key);
    boolean search(E key);
}

/*
 *
 *  BinaryTree.java
 *
 */

public abstract class BinaryTree<E> implements Tree<E> {

    protected class Node<T> {
        protected Node(T data) {
            this.data = data;
        }
        protected T data;
        protected Node<T> left;
        protected Node<T> right;
    }

    protected Node<E> root;
}

/*
 *
 *  BinarySearchTree.java
 *
 */

import java.util.Iterator;

public class BinarySearchTree<E extends Comparable<? super E>> extends BinaryTree<E> {

    public void insert(E data) {
        return;
    }

    public Iterator<E> iterator() {
        return null;
    }

    public void remove(E key) {
        return;
    }

    public boolean search(E key) {
        return false;
    }
}

Reference no: EM131963250

Questions Cloud

Cloud-based file synchronization : How is backup data files different from a cloud-based file synchronization?
What is current bond price : If the YTM on these bonds is 10.2 percent, what is the current bond price?
What are the most critical issues facing healthcare system : What are the most critical issues facing the healthcare system in the United States today? Find at the websites of these major health organizations.
Constructing tables with microsoft access : Construct an Access database with two tables using the graphical capabilities of the product (vs. SQL).
Implement the binarysearchtree class : Please assist me on this assignment. Implement the BinarySearchTree class. The BinarySearchTree class extends the BinaryTree class which implements
Discuss the sociological research design method : Imagine you are a sociological researcher studying academic dishonesty at your University. Identify at least one research question you would address.
Prepare a interview essay based on clinical reasoning cycle : Prepare a interview essay based on clinical reasoning cycle. The main essay topic is interview essay on topic healthy ageing based on clinical reasoning cycle.
Test a field for membership in a set of values or fields : After the field name, use the 'in' operator followed by the set items surrounded by braces . Use the following filter tcp.port in {80 53 8080}.
What is present value of cash flow : What is the present value (as of today) of the cash flow that is expected to be made in 4 years?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  What are search methods

What are search methods? Do you feel search methods are relevant to topics in artificial intelligence ? If yes, please explain why and how. Specifically, describe how search methods would be used for rule-based systems, expert systems, resolu..

  Define artificial intelligence

Provide a reference list of at least 8-sources that are properly cited according to APA format. I would like to see a variety of sources, for example not just articles from one journal.

  Negotiating for something or against someone

What is one example you can share of a pivotal moment you have experienced while negotiating for something or against someone?

  In the logicworks/designworks simulation logic library

In the Logicworks/Designworks Simulation Logic library, there is a module called Counter-4 UP w/o EN which counts the sequence 0000, 0001, 0010, ... , 1110, 1111, 0000, 0001, ... . Create a continuous mod 10 counter using the 'Counter-4' module..

  For each of the statements below

For each of the statements below (I, II and III), indicate whether the statement applies to a) a scalar processor, b) a superscalar processor or c) a multi-threaded processor.

  Explain what the binary numbers s m and e represent

Explain what the binary numbers s, m and e represent. How many bits would typically be used for s, m and e in a single-precision floating-point number?

  Compare outsourcing it cloud support with in-house it

Compare outsourcing IT cloud support with in-house IT support. Describe methods to migrate the organizational resources to a cloud environment.

  Prohibits the import of foreign-made pharmaceuticals

The imaginary nation of Washington prohibits the import of foreign-made pharmaceuticals.

  Write an interactive menu-driven program

Use the data given above to carry out the conversions. Design the program so that it executes repeatedly, until a stopping condition is selected from the menu.

  Calculate the maximum number of pins

You are required to calculate the maximum number of PINs that the thief may have to enter before correctly discovering the customer's PIN?

  Let a be the set of all ist students who graduate

Let A be the set of all IST students who graduate

  Implementation of the finger protocol

In addition, write a 5- to 7-page paper documenting the changes that you made and analyzing the impact the changes will have on the overall throughput and latency of the server.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd