JAVA
Add the BinarySearchTree<T extends
Comparable<T>> class you know from the lecture, which you
can find in the appendix. When implementing the required
method, only the methods listed in the appendix may be used.
Only one method may be added to the BinarySearchTree
class.
[Create the public T bigOn( int n ) method.
The bigOn method returns the largest content stored at level n of
the tree. If the tree has no n levels, null is returned.
The root is at level 0. The tree must not be changed by
executing the bigOn method.
Anhang - Programmcode der Klasse BinarySearchTree T extends Comparable<T>> public class BinarySearchTree<T extends Comparable<T>> { private T content; private BinarySearchTree<T> leftChild, rightChild; public BinarySearchtree() {...} public T getContent() {...} public boolean isEmpty() {...} public boolean isLeaf() {...} public boolean isTree Iterable<T> data) { Iterator<T> it = data. iterator(); return treeCheck it ) && (!it.hasNext()); } } Anhang - Programmcode der Klasse DoublyLinkedList<T> public class DoublyLinkedList<T> { private Element first, last; private int size; public DoublyLinkedList() {...} public int size() {...} public boolean isEmpty() {...} // Element private static class Element { private T content; private Element pred, succ; public Element(TC) {...} public T getContent() {...} public void setContent TC) {...} public boolean hasSucc() {...} public Element getSucc() {...} public void connectAsSucc( Element e) {...} public void disconnectSucc() {...} public boolean hasPred() {...} public Element getPred() {...} public void connectAsPred( Element e) {...} public void disconnect Pred() {...} } Anhang - Programmcodes der Interfaces public interface Iterator<T> { public abstract boolean hasNext(): public abstract T next(); } DAP 1 - Klausur public interface Iterable<T> { public abstract Iterator<T> iterator(): } public interface Comparable<T> { public abstract int compareTo(Tt); // Der Rückgabewert ist positiv, falls das // aus führende Objekt größer als t ist.
JAVA Add the BinarySearchTree> class you know from the lecture, which you can find in the append
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am