Are empty Binary Search Trees valid?

前端 未结 7 1457
挽巷
挽巷 2021-01-12 12:48

I have two questions regarding binary search trees, both about empty trees.

  1. Is an empty tree (null) valid?
  2. Is a root node without children valid?
7条回答
  •  不要未来只要你来
    2021-01-12 13:17

    A binary tree can be defined recursively as:

    A single node with either no children, or with two children - 
    each of which is a binary tree.
    

提交回复
热议问题