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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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