d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > 1k Fg For Help On Binary Search Trees Java
12Next
Add Reply New Topic New Poll
Member
Posts: 24,101
Joined: Nov 8 2007
Gold: 5,561.70
Jul 2 2012 06:56pm
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
Member
Posts: 24,101
Joined: Nov 8 2007
Gold: 5,561.70
Jul 2 2012 07:18pm
Already have the add method btw.


Code

public boolean add(K key, V data) {
 if (root == null) {
  root = new Node(key, data);
  return true;
 } else {
  return addAux(key, data, root);
 }
}

private boolean addAux(K key, V data, Node rootAux) {
 int comparison = key.compareTo(rootAux.key);
 if (comparison == 0) {
  rootAux.data = data;
  return false;
 } else if (comparison < 0) {
  if (rootAux.left == null) {
   rootAux.left = new Node(key, data);
   return true;
  } else {
   return addAux(key, data, rootAux.left);
  }
 } else {
  if (rootAux.right == null) {
   rootAux.right = new Node(key, data);
   return true;
  } else {
   return addAux(key, data, rootAux.right);
  }
 }
}



This post was edited by lopelurag on Jul 2 2012 07:20pm
Member
Posts: 24,101
Joined: Nov 8 2007
Gold: 5,561.70
Jul 2 2012 08:45pm
This offer lasts for another 9 hours, going to sleep at the moment.
Member
Posts: 4,980
Joined: Jan 16 2010
Gold: 0.00
Warn: 20%
Jul 2 2012 09:41pm
You need to answer these assignments, as they're the stuff you'll be quized in, not because they're mandatory. Having someone work out the code will still leave you way behind. Furthermore, the quiz is closed book and closed notes, so you're not allowed to bring these answers anyways. Prepare for your tests by studying.

Now, if you wanted to have these questions answered, you'd be able to Google the answers easily, just like I could Google your assignment without any trouble at all. If you'd rather learn, describe the parts you're having trouble with, and the capable few people of this subforum will be more than happy to assist you.
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Jul 3 2012 03:02am
your doubleposting of every single topic you make is getting kind of old.
Member
Posts: 133
Joined: May 31 2012
Gold: 401.60
Jul 3 2012 09:45am
If you wait a bit I do have this exact project completely completed with all methods included which I will provide to you for 600 fg if you desire. I'll also give you an extra explanation on any methods you need understanding with for an addition 400 fg.

In other words, Project done and tutoring for the exam/quiz for 1k fg. PM me if interested.
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Jul 3 2012 11:23am
Quote (neems @ Jul 3 2012 08:45am)
If you wait a bit I do have this exact project completely completed with all methods included which I will provide to you for 600 fg if you desire. I'll also give you an extra explanation on any methods you need understanding with for an addition 400 fg.

In other words, Project done and tutoring for the exam/quiz for 1k fg. PM me if interested.


you seriously just lowered the price for him?

wow.
Member
Posts: 133
Joined: May 31 2012
Gold: 401.60
Jul 3 2012 11:36am
Quote (irimi @ Jul 3 2012 01:23pm)
you seriously just lowered the price for him?

wow.


I seriously don't give a shit if he wants to fail his course and if he plagiarizes my source code that I offer him, he will fail it anyway if it's the course that I think he is taking as they check for identical submissions. I offered a lower price because for me it's zero work as I have already completed this assignment and he is welcome to look at my source code for a cheaper price considering he can't just use the code. If he wants me to help him write his own and understand it, he has to pay full price.

It wasn't a lower price. It's less work, less money. Think of it as being fair
Member
Posts: 2,201
Joined: Nov 29 2007
Gold: 0.00
Jul 10 2012 02:02pm
I can do this with full comments.
Member
Posts: 24,101
Joined: Nov 8 2007
Gold: 5,561.70
Jul 10 2012 06:01pm
I no longer need this, it was a practice exercise and I just wanted to check my answers.
Go Back To Programming & Development Topic List
12Next
Add Reply New Topic New Poll