Question: hello, can you help me with this exercise. I'm trying to practice it. thank you, import java.util.Collection; public interface Tree < E > extends Collection

hello, can you help me with this exercise. I'm trying to practice it.

thank you,

import java.util.Collection; public interface Tree<E> extends Collection<E> {  /** Return true if the element is in the tree */  public boolean search(E e);  /** Insert element e into the binary tree  * Return true if the element is inserted successfully */  public boolean insert(E e);  /** Delete the specified element from the tree  * Return true if the element is deleted successfully */  public boolean delete(E e);   /** Get the number of elements in the tree */  public int getSize();     /** Inorder traversal from the root*/  public default void inorder() {  }  /** Postorder traversal from the root */  public default void postorder() {  }  /** Preorder traversal from the root */  public default void preorder() {  }    @Override /** Return true if the tree is empty */  public default boolean isEmpty() {   return this.size() == 0;  }  @Override  public default boolean contains(Object e) {   return search((E)e);  }   @Override  public default boolean add(E e) {   return insert(e);  }   @Override  public default boolean remove(Object e) {   return delete((E)e);  }   @Override  public default int size() {   return getSize();  }  @SuppressWarnings("unchecked") @Override  public default boolean containsAll(Collection c) {   // Left as an exercise    return true;  } @SuppressWarnings("unchecked") @Override  public default boolean addAll(Collection c) {   // Left as an exercise     return true;  } @SuppressWarnings("unchecked") @Override  public default boolean removeAll(Collection c) {   // Left as an exercise    return true;  } @SuppressWarnings("unchecked") @Override  public default boolean retainAll(Collection c) {   // Left as an exercise    return true;    }  @Override  public default Object[] toArray() {   // Left as an exercise    return temp;  } @SuppressWarnings("unchecked") @Override  public default  T[] toArray(T[] array) {   // Left as an exercise    return array;  }  } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!