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
精彩评论