IF OBJECT_ID('Tempdb..#Tree', N'U') IS NOT NULL DROP TABLE TEMPDB..#Tree
/*Table having member node, parent node and the location of child either left or right*/
/*Inserting dummy values into #Tree*/
1, 0, 0, 0
2, 1, 1, 0
3, 1, 0, 1
4, 2, 1, 0
5, 2, 0, 1
6, 3, 1, 0
7, 3, 0, 1
8, 4, 1, 0
9, 4, 0, 1
10, 5, 1, 0
11, 5, 0, 1
12, 7, 0, 1
13, 7, 1, 0
14, 8, 1, 0
15, 8, 0, 1
16, 14, 1, 0
17, 14, 0, 1
18, 17, 1, 0
19, 17, 0, 1
IF OBJECT_ID ('TEMPDB..#Interim', N'U') IS NOT NULL DROP TABLE #Interim
/*Table having member node and immediate son(s)*/
/*Code for finding immediate son(s)*/
/*Inner table "Interim" contain nodes which have both left and right child*/
/*Running the loop for <(maximum number of node)/2> times, since we don't know the level of depth and it can be any
kind of tree*/
The images cant be seen here so I would recommended if you could please follow this link
Carsten Siemens edited Revision 2. Comment: Fixed the images urls
Thanks Carsten Siemens.
Naomi N, I can see your comment in my mail box but why not here. Beyond me!
BTW would you please let me know where did you find the problems with the grammar. Whole time I was concentrating on technical, did not see this coming. :-)
There are two types of the comments. One type is on the article itself and another type is the revision comments (e.g. when you make a revision, you may tell what you did). The second type of the comments should be visible if you click on the history tab of the article.
himansu ji i cheked link which is provide by but can not understand
if you provide full stored procedure for counting total number of pairs in 2:1 ratio or 1:2 ( 2 left nodes and 1 right node for a given node or 1 left node and 2 right node for a given node )ratio for first payment and after that in 1:1 ratio means 1 left and 1 right node for a given node for all other payment.
if new user join first from left then pair counting start from left ,if new user join first from right then pair counting start from left.