I am creating MLM website and now I want to build binary tree.. So that user enter their private id and select the sponsor id.
The binary tree should work as follows :
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
Thank you.
maintain left_child
, right_child
, and sponser_id
in each row (record of a member)
| ID | Name | left_child | right_child | sponser_id |
|:-----------|------------:|:-----------:|:------------:|:----------:|
| 1 | Root | 2 | 2 | |
| 2 | child-2 | 4 | 5 | 1 |
| 3 | child-3 | 6 | 7 | 1 |
| 4 | child-4 | x | y | 2 |
| 5 | child-5 | a | b | 2 |
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.