二叉搜索树只能有两个分支吗?

can a binary search tree has two branches only?

根据GeeksForGeeks,二叉树在以下情况下是 BST:

The left subtree of a node contains only nodes with keys lesser than the node’s key.
The right subtree of a node contains only nodes with keys greater than the node’s key.
The left and right subtree each must also be a binary search tree.

不知道像下面这样的树还能算BST吗?

     3
   2   4
 1       5
0

一句话-是的。没有要求树是“完整的”(即每个节点应该恰好有两个 children.

是的,符合要求,所以是二叉搜索树。即使这种退化的情况仍然是二叉搜索树:

        4
       /
      3
     /
    2
   /
  1 

出于效率原因,可以更新(插入或删除)的二叉搜索树通常会重新平衡,以最小化它们的高度。存在不同的技术来平衡二叉搜索树。参见 self balancing binary search tree