Solved

Tree Traversal

Posted on 2012-12-23
5
462 Views
Last Modified: 2012-12-26
Can anyone point me to sample code snippets for traversing n-ary tree with k-nodes randomly may be based on some conditions like a Node holding a boolean variable with value as true etc?
0
Comment
Question by:jagadeesh_motamarri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 38717737
Sounds like homework.  Why don't you write something and we'll help you with it if you have problems?
0
 
LVL 10

Author Comment

by:jagadeesh_motamarri
ID: 38717886
LOL!!
 I know the obvious rules and kind of missed it [may be because I have in-active for quite sometime in the forum]! I have been part of this community for almost 6 years. Don't think I am in a place to ask home work questions here :-)

If not sample code, you can at least give me pointers on how nodes be accesses randomly!

Anyways, I'll try to post something for tomorrow and see how it goes.

Thanks!
0
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 38717920
You would have to decide what randomly means to you. You could use the random number generator and convert the results to an identifier of a node in your tree.  The whole topic of true randomness is a difficult one.

Or maybe you just mean that you will get requests for nodes and the node might be anywhere in the tree?

You've been asking a series of questions about n-ary trees.  Are you able to describe your problem more clearly?  The reason your questions sound like homework is that the problem descriptions sound like the sort of not real problems you would get in a class.
0
 
LVL 10

Author Comment

by:jagadeesh_motamarri
ID: 38718628
Or maybe you just mean that you will get requests for nodes and the node might be anywhere in the tree?
This is correct.

You've been asking a series of questions about n-ary trees.  Are you able to describe your problem more clearly?
Please look at my other question here

I have more detailed explanation of What I was trying to achieve.
0
 
LVL 27

Accepted Solution

by:
mrcoffee365 earned 500 total points
ID: 38718854
Yes, that's what I looked at when I was trying to determine whether this was homework or not.  Very generic description.

If you don't post any code, it's harder to get a response from EE.  We don't write code for people.  Given the vagueness of your question, have you tried googling?  I found many, many responses, both of the general problem and with some code samples.  So, for example:
http://vivin.net/2010/01/30/generic-n-ary-tree-in-java/
http://www.cs.auckland.ac.nz/~jmor159/PLDS210/n_ary_trees.html

That might be best if you don't want to write any code at this time.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Chrome and Firefox Java 5 88
dao vs facade design patterns 2 70
Given a github repo find email address of all collaborators in that repo 1 56
Html split(text) 2 49
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question