Find Jobs
Hire Freelancers

BinaryTree class

$30-250 USD

Completed
Posted over 9 years ago

$30-250 USD

Paid on delivery
Add the following methods to the class BinaryTree shown below: public T get(int i) public void add(int i, T element) public T remove(int i) All these methods use the inorder traversal of the tree. Feel free to use helper methods and/or extra fields. Here are the description of what the methods do. --------------------------------------------------------------------------------- get(i) returns the element of the i-th node of the inorder traversal of the tree. If i is outside the range it throws a NOSuchElementException. For example if the inorder traversal of the tree t is a, b, c, d, e, f, g, h, i, j, k [login to view URL](4) returns e. ---------------------------------------------------------------------------------- public void add(int i, T element) inserts element in the tree such that it is the i-th item in the inorder traversal. Throw an index out of bounds exception if i is out of bounds and increase size if the insertion is successful. For example if the inorder traversal of the tree t is a, b, c, d, e, f, g, h, i, j, k after the call [login to view URL](5, x); the inorder traversal of t is a, b, c, d, e, x, f, g, h, i, j, k ----------------------------------------------------------------------------------- public T remove(int i) removes the i-th item of the tree. Throw a no such element exception if i is out of range. Don't forget to decrease the size if the remove is successful. For example if the inorder traversal of the tree t is a, b, c, d, e, f, g, h, i, j, k the call [login to view URL](5); returns f and the inorder traversal of t is a, b, c, d, e, g, h, i, j, k -------------------------------------------------------------------------------------- Here is the class [login to view URL] import [login to view URL]; public class BinaryTree<T> { /** Creates an empty binary tree */ public BinaryTree() { root = null; } // create a binary tree with a given root value public BinaryTree( T rootItem) { root = new BinaryNode( rootItem, null, null); size = 1; } // @return the root of the tree public BinaryNode<T> getRoot() { return root; } // @return the size of the tree public int size() { return size; } // @return the the height of the tree public int height() { return [login to view URL](root); } // print the tree in preorder public void printPreOrder() { if (root != null) [login to view URL](); } // print the tree in postorder public void printPostOrder() { if (root != null) [login to view URL](); } // print the tree in inorder public void printInOrder() { if (root != null) [login to view URL](); } // empty the tree public void makeEmpty() { root = null; size = 0; } // check if the tree is empty public boolean isEmpty() { return root == null; } // forms a new tree from rootItem t1 and t2 // does not allow t1 and t2 to be the same public void merge(T rootItem, BinaryTree<T> t1, BinaryTree<T> t2) { if ([login to view URL] == [login to view URL] && [login to view URL] != null) throw new IllegalArgumentException(); // allocate new node root = new BinaryNode<T>(rootItem, [login to view URL], [login to view URL]); size = [login to view URL]() + [login to view URL]() + 1; // ensures that every node is in one tree if (this != t1) [login to view URL] = null; if ( this != t2) [login to view URL] = null; } private BinaryNode<T> root; private int size = 0; }
Project ID: 6731107

About the project

18 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hi, I will be able to do this in a day time. Please let me know if you would like me to assist you with this project. We have already done two projects on the same lines. So I would be happy to continue the relationship further.
$50 USD in 1 day
4.8 (17 reviews)
4.3
4.3
18 freelancers are bidding on average $49 USD for this job
User Avatar
Hi, I am placing my bid on your project because I have read the requirements and I am confident enough with my Java and algorithm skills. I am focused mostly on doing computer science work here in freelancer.com and I would like to help you get this project done if you would give me the opportunity. I am a computer science professor and practitioner and this assignment is one of the fields that I teach very well so I can assure you an accurate result. Let me know if you are interested so I can start. Thanks.
$30 USD in 1 day
5.0 (1093 reviews)
7.7
7.7
User Avatar
HI Contact me for an efficient, perfect, well documented development of your project according to 100% accuracy and requirements, with dedicated support. Thanks Farah Saif
$30 USD in 1 day
5.0 (514 reviews)
7.4
7.4
User Avatar
Hello. I am experienced with Java and I am familiar with Binary Tree data structure very well. It can be done in few hours.
$30 USD in 1 day
4.9 (637 reviews)
6.9
6.9
User Avatar
Dear sir. I've scrutinized your project description. Because I have mastered "Data structure and Algorithm", I can surely do this very quickly and cleanly. Choose me to have the best one.
$210 USD in 3 days
5.0 (13 reviews)
6.8
6.8
User Avatar
I am very proficient in java. I have 12 years java developing experience. I have worked for 5 years, my work is online game developing, and mainly focus on server side, the language is java under linux, I am proficint in c++ also. I used java to make many great projects. For example, I made the tools which can convert PWScript(a script language created by our company) to c++ files. I made our own mobile games, and i am mainly responsible for the server side, and it was built using java. I can even show you the mobile game client. Please let expert help you.
$30 USD in 1 day
4.9 (88 reviews)
6.5
6.5
User Avatar
Hello. I am interested in your project. I have required skills and experience in Java development including working with data structures. I have completed several projects on this freelancer site and on others resources. All of them were successful. I am able to complete your assignment today and with good quality. Fill free to contact me so we can discuss any details. Thank you for your consideration. Vitalii Oleksiv
$30 USD in 1 day
5.0 (37 reviews)
5.8
5.8
User Avatar
Hello, I am Java expert. I am willing to help you do this project right now. Please contact me. Thank you
$55 USD in 1 day
5.0 (53 reviews)
5.5
5.5
User Avatar
Hello, I have 6 years experience in java. I can do this assignment. Please message me for further discussion.
$30 USD in 2 days
4.9 (103 reviews)
5.5
5.5
User Avatar
I can do this project, choose me, please :) ..................................................................
$30 USD in 3 days
5.0 (7 reviews)
5.0
5.0
User Avatar
hey buddy contact me and I will complete this in less than one hour...you can see my profile my speed and quality for any work is very great
$100 USD in 3 days
5.0 (13 reviews)
3.4
3.4
User Avatar
I have read and understand your requirements Please open chat window to discuss further.. ++++++++++++++++++++========================+++++++++++++++++++++++++++++++++++++++++
$30 USD in 1 day
4.7 (8 reviews)
3.7
3.7
User Avatar
Hello There I am 5 year Java Experienced I will do it for you in very short time , will also add comments if you want to code Thank in advance Hiasat
$30 USD in 1 day
5.0 (12 reviews)
3.2
3.2
User Avatar
This project is easy. I can make it with clean code, understanding comment :) If you need explanation, I can hold a quick talk via skype if needed (but I got a flu now, please wait for 1-2 days).
$55 USD in 3 days
4.6 (4 reviews)
2.1
2.1
User Avatar
Hi sir :)) , i'm a 3 years contestant in ACM ( algorithms and programming contest ) , them i became a coach and judge in the national version , i'm really good in algorithms and java programming , please consider mu bid :))
$30 USD in 0 day
0.0 (0 reviews)
0.0
0.0
User Avatar
A proposal has not yet been provided
$35 USD in 2 days
0.0 (0 reviews)
0.0
0.0
User Avatar
Dear sir, if you would like to hire me, let me know. I am engineering undergraduate of University of Moratuwa, Sri Lanka. I will support you in my best. Thanks in advance.
$30 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
We are the leading young professional software development organization having extensive technical expertise and knowledge in developing, managing, optimizing and customizing software’s by implementing these software’s in different demanding programming tools and latest technologies especially in ASP,ASP.net,VB,VB.net,Linux, C++, C #, Java, SQL, Access. We have fully studied your project requirements description and also highlight main points in order to perform your demands which is required to complete the project in a given proposed time frame, as our commitment is a key to our successful journey which also inspired our employers who gave us the full rating on our completed projects as a "Project Completion Rate" which is also shown in our profile. Moreover we are also fully committed to accomplish the task assigned by you with the required state of the art technology to fulfill your requirements as prescribed in this project. I thinks that this is the best way to utilize our impressive skills under the light of our previous experiences and excellent reviews given by the employers. We wish to render you our services and hopeful not to let you disappoint. We will also be responsive with a positive gesture without demanding any further cost. We are quite optimistic in a bid to receive this project. Thanks With Best Regards Your Well Wisher Motivated Young Freelancer
$44 USD in 3 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
cooper city, United States
5.0
6
Payment method verified
Member since Oct 17, 2014

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.