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
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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
Answered
bLuEmEzzy
Junior Poster
121 posts since Feb 2011
Reputation Points: 10
Solved Threads: 6
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
Solved Threads: 17
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
Solved Threads: 6
Skill Endorsements: 2
Question Answered as of 8 Months Ago by Maligui

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0603 seconds using 2.65MB