开发者

how to represent a Binary Search Tree as a database schema?

I need to represent Binary Search Tree as a DB schema? How do I do it?开发者_运维技巧 Its kind of problem. I dont have any code. I need direction how to show BST as a DB schema.


Sample:

id   |    value   |   left_id  |   right_id   |   parent_id (optional)
1    |    100     |     2      |   3          |     NULL    
2    |    50      |   NULL     |   NULL       |   1
3    |    150     |   NULL     |   NULL       |   1

will represent:

  100
 /   \
50   150
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜