Binary Search Tree

plus_plus 2002-12-07 05:08:17
A binary search tree is a binary tree that has left children less than the parent and right children greater than parent. A example is like this 7
/ \
4 9

if its child is eaqual to the parent, is it still a binary tree?
7
/ \
4 7
...全文
37 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
boytan 2002-12-10
  • 打赏
  • 举报
回复
对,二叉搜索树中不能有相同健值的节点,你看看二叉搜索树的插入算法就可以知道,它现在当前的二叉搜索树中搜索要插入的健值,如果当前二叉搜索树已经存在这个健值的节点,就return不做插入。
CarGo 2002-12-07
  • 打赏
  • 举报
回复
The answer is NOT.
No two entries in a binary search tree can have equal keys,since the
keys in the left subtrees are strictly smaller than the key in the
root,and those in the right subtree are strictly greater.
键值是排序的依据,不能相同,否则就不叫BST了。

33,027

社区成员

发帖
与我相关
我的任务
社区描述
数据结构与算法相关内容讨论专区
社区管理员
  • 数据结构与算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧