I need someone to implement the following methods, they shouldn't be hard. I'll pay someone 1k fg to do this tonight.
1. Define a constructor that creates an empty tree.
2. Define a recursive method add(K key, V data) that adds a key,value pair to the proper location in the tree.
3. Define a recursive method size() that returns the number of entries in the tree.
4. Define a non-recursive method max() that returns the data associated with the maximum key value in the tree.
5. Define a recursive method max() that returns the data associated with maximum key value in the tree.
6. Define a recursive method min() that returns the data associated with minimum key value in the tree.
7. Define a recursive method named postOrderTraversal() which returns a string representing a post-order
traversal of the tree.
8. Define a recursive method getNumInteriorNodes() that returns the number of non-leaf nodes in the tree.
9. Define a recursive method getHeight() that returns the height of the tree.
10. Define a recursive method leaves(ArrayList<K> L) that adds to the ArrayList L, the key value of leaf nodes.
11. Define a recursive method isDegenerate() that returns true if a binary search tree is a degenerate tree and false
otherwise. A degenerate tree is one where every node has only one child.
12. Define a recursive method getDecreasingOrderList() that returns an ArrayList with the data elements of the
tree inserted into the list based on decreasing key order.
Code
public class BinarySearchTree <K extends Comparable<K>, V> {
private class Node {
private K key;
private V data;
private Node left, right;
public Node(K key, V data) {
this.key = key;
this.data = data;
}
}
private Node root;
}
Or post a price for how much this will cost.This post was edited by lopelurag on Jul 2 2012 07:13pm