Difference between binary tree and binary search tree

后端 未结 12 1675
情深已故
情深已故 2020-11-29 14:44

Can anyone please explain the difference between binary tree and binary search tree with an example?

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 15:12

    A binary tree is a tree whose children are never more than two. A binary search tree follows the invariant that the left child should have a smaller value than the root node's key, while the right child should have a greater value than the root node's key.

提交回复
热议问题