Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
392 views
in Technique[技术] by (71.8m points)

algorithm - How to create a forced matrix

I have this requirement to create a tree like structure. Each parent can have at most 3 children. And the tree grows 15 level deep (total 3^15 members). The thing is, addition of child nodes are done by giving each parent a child. For example

                  1
      2           3             4
   5  8  11     6 9 12       7 10 13

Tree grows like this. 5th child goes under 2, 6th child goes under 3, 7th child goes under 4, 8 again under 2... etc. I am given the root node and member to be added, for example, 1 and 10. How can I programmatically find which position the new child should be added?. An answer with an algorithm would be much helpful


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...