|
-
Nov 14th, 2008, 07:29 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Tree Traversal
hi all,
i have a problem, please help me out to solve this issue,
i have to traverse a Tree from Given Root and i have to count its Left Childs And Its Right Childs.
I have a database which stores this all information.
A Root can have only TWO Childrens.
Please tell me how can i count ROOT(S), Left And Right Childs
In table im saving all this like this
Field Name : Assigned_Left_To (Left Child ID)
Field Name : Assigned_Right_To (Right Child ID)
please solve my problem and give me a function to solve this problem
-
Nov 14th, 2008, 10:47 AM
#2
Re: Tree Traversal
Hi chunk,
I don't understand exactly what you are looking for, your going to have to be much more specific if you want anybody to solve your problem.
 Originally Posted by chunk
i have to traverse a Tree from Given Root and i have to count its Left Childs And Its Right Childs.
What do you mean by a given root? Do you mean a record in the database table called root?
 Originally Posted by chunk
I have a database which stores this all information.
You're going to need to tell us the table structure for all tables that are relevant.
 Originally Posted by chunk
A Root can have only TWO Childrens.
Please tell me how can i count ROOT(S), Left And Right Childs
If a root can only have 2 children then why do you need to count them, according to that there will always be 2.
 Originally Posted by chunk
In table im saving all this like this
Field Name : Assigned_Left_To (Left Child ID)
Field Name : Assigned_Right_To (Right Child ID)
What is this? Table structure for the 'root' table? If so, can't you just check if Left is 0 and if Right is 0, that will tell you there is 0 children, if Left and Right have a value then you have 2 children.
 Originally Posted by chunk
please solve my problem and give me a function to solve this problem 
A function? Are you looking to create a fuction, if so what are the inputs, what are the outputs and what exactly is the purpose? Or are you referring to built in functions such as the COUNT() function of SQL?
-
Nov 14th, 2008, 12:38 PM
#3
Thread Starter
Fanatic Member
Re: Tree Traversal
thanks for repling me the182guy
you are right i should have been explain my problem in good manner and with good explanation.
i have found the solution of it, and it is now working fine for me.
if in future i need any help regarding this topic. i will continue this thread. or i will start a new one.

thank you so much for repling me bro
-
Nov 14th, 2008, 01:02 PM
#4
Re: [RESOLVED] Tree Traversal
No problem chunk, glad you sorted it out
-
Nov 14th, 2008, 03:20 PM
#5
Thread Starter
Fanatic Member
Re: [RESOLVED] Tree Traversal
thanks again for your reply bro
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|