1,105,380 Community Members

Arraylist<node> based trees

Member Avatar
sugir1987
Newbie Poster
23 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

hi all
i have to implement arraylist<node> base tree(one parent may have more than two children). i did not work with node can you help me to create the tree

Member Avatar
stultuske
Posting Expert
5,332 posts since Jan 2007
Reputation Points: 938 [?]
Q&As Helped to Solve: 776 [?]
Skill Endorsements: 35 [?]
Featured
 
0
 

what have you done so far?

Member Avatar
sugir1987
Newbie Poster
23 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

what have you done so far?

i'm a beginner of java.can you help me to create the tree?

Member Avatar
sugir1987
Newbie Poster
23 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

hi all
i have to implement arraylist<node> base tree(one parent may have more than two children). i did not work with node can you help me to create the tree

i'm a beginner of java.can you help me to create the tree?

Member Avatar
stultuske
Posting Expert
5,332 posts since Jan 2007
Reputation Points: 938 [?]
Q&As Helped to Solve: 776 [?]
Skill Endorsements: 35 [?]
Featured
 
0
 

we can help you correct your code, we're not going to code it for you.
Do you know how to work with (Array)Lists and Generics?

if not, and you're indeed a beginner just starting up, leave stuff like this untill you've got a better hang of java programming.

Member Avatar
sugir1987
Newbie Poster
23 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

we can help you correct your code, we're not going to code it for you.
Do you know how to work with (Array)Lists and Generics?

if not, and you're indeed a beginner just starting up, leave stuff like this untill you've got a better hang of java programming.

i'm working with arraylist

Member Avatar
sugir1987
Newbie Poster
23 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

i'm working with arraylist

i can implement the binary tree in java. at least help me to insert the children into the arraylist here one parent may have more than two children

Member Avatar
NormR1
Posting Sage
7,723 posts since Jun 2010
Reputation Points: 563 [?]
Q&As Helped to Solve: 793 [?]
Skill Endorsements: 16 [?]
Team Colleague
 
0
 

Have you read the API doc for the ArrayList class?
Do any of its methods look like they would "insert" an element into the list?
Have you tried any of the methods to see what they do?
Try writing a small, simple program that creates an ArrayList and add elements to it.

Member Avatar
sugir1987
Newbie Poster
23 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Have you read the API doc for the ArrayList class?
Do any of its methods look like they would "insert" an element into the list?
Have you tried any of the methods to see what they do?
Try writing a small, simple program that creates an ArrayList and add elements to it.

now i have to create dynamic children tree.a single array-list is possible to do this?
for example i have to create this kind of tree

7
/ | \
2 7 12
/ | \ / \ / \
1 2 3 6 8 11 13

here each parent has average of children. here i have three condition such as (consider the child node as x) 1<=x<=5,6<=x<=10,x>=11.here i have three group of children.how can separate this group of children from a single array-list. is it possible or not. if it is possible can you give me a code to insert the children in array-list (with example).

Member Avatar
NormR1
Posting Sage
7,723 posts since Jun 2010
Reputation Points: 563 [?]
Q&As Helped to Solve: 793 [?]
Skill Endorsements: 16 [?]
Team Colleague
 
0
 

Yes, I think you can do it.

Member Avatar
sugir1987
Newbie Poster
23 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Yes, I think you can do it.

can you give me any idea to solve this problem?

Member Avatar
NormR1
Posting Sage
7,723 posts since Jun 2010
Reputation Points: 563 [?]
Q&As Helped to Solve: 793 [?]
Skill Endorsements: 16 [?]
Team Colleague
 
0
 

Are you having problems with your code?
Please post your code and your questions.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article