That depends on the application and is a question of definition.
Edit:
For example Wikipedia "defines" a BST as follows:
In computer science, a binary search tree (BST), sometimes also called an ordered or sorted binary tree, is a node-based binary tree data structure which has the following properties:
- The left subtree of a node contains only nodes with keys less 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 must each also be a binary search tree.
- There must be no duplicate nodes
Let's test those for null
:
- left subtree doesn't exist, so there are no nodes violating this rule -> check
- similiar to first -> check
- if all this tests are passed this passes too, since both subtrees are null -> check
- of course there aren't duplicates -> check
So by this definition null
is a valid BST. You could inverse this by also requiring "there must be one root node". Which doesn't affect any of the practical properties of a BST but might in an explicit application.