0

I m working on a MLM project in which i have to store member automatically in binary tree form like

1 is root
2 is child of 1
3 is child of 1

Then 4 is child of 2
5 is child of 2

6 is child of 3
7 is child of 3


then 8 is child of 4

and so on ......


can any body help me

3
Contributors
2
Replies
5
Views
9 Years
Discussion Span
Last Post by bsnmurty
0

Do you want to have it self balancing?
If you don't care (little slower) then you should write a Binary Tree class with a generic add method adds the children to the correct position by looping through the tree and checking where it goes.

I guess it depends on how big your tree is going to be. If you're going to have a lot of records in your tree then you should try to find a self-balancing class that's written in php (or in another language like C++ and adapt it). If it's not going to be that large (maybe 20 records or so at a time) then you can just do an un-balanced tree.

0

Hi want to create a binary tree using table registration having fields id, parent_id, user_name.
id Parent_id user_name
1 0 SF8011049
2 1 SF6542248
3 1 SF2998128
4 2 SF2518457
5 2 SF7055311
6 3 SF0207585
7 3 SF6258770

Please tell how to create binary using this table. Please any body help me to display binary tree having username in the tree structure. Please help me.

Please quick replay
Murty

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.