We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,498 Members — Technology Publication meets Social Media

# Nodes like in Binary tree

please help.. how to program nodes(like in binary tree) the root node is (1) then left(LNode) is (2) and right(RNode) is (3).. then for (2)- LNode of (4) RNode (5).. for 3-- LNode(6) RNode(7)..so on.. how can i do that.. then the numbers are in the database.. Thanx

2
Contributors
2
Replies
4 Days
Discussion Span
9 Months Ago
Last Updated
3
Views
Question
bLuEmEzzy
Junior Poster
121 posts since Feb 2011
Reputation Points: 10
Skill Endorsements: 2

This sounds like an interesting application. I just need some clarification... We're both in the same car, I just want to know where what road we're on, and if the road leads to green pastures :-).

From what I am getting, the root node determins the LNode and RNode:

``````|Lnode|Root|RNode|`
2    1    3
4    2    5
6    3    7
8    4    9
``````

If that is the case, I would multiple the root by 2 this will give you LNode, then add one to get the value of RNode.

``````Private Sub CalculateNodes(root As Integer)
' declare the nodes
Dim LNode, RNode as Integer

'assign the nodes
LNode = root * 2
RNode = LNode + 1
End Sub
``````
Maligui
Junior Poster in Training
84 posts since Aug 2012
Reputation Points: 0
Skill Endorsements: 2

thank you for the idea. I will contact you for progress thank you so much.

bLuEmEzzy
Junior Poster
121 posts since Feb 2011
Reputation Points: 10