Your min_key
and max_key
variables are calculated using min
and max
function respectively.
You may remove None
's, but there’s also node.key
(that’s probably always present) which becomes the new minimum/maximum.
You don’t always return None
, you do it only when the node
is None
.
but sir, we are not returning anything other than None
either.
You return is_bst_node
, min_key
and max_key
.
The last two values are result of min()
and max()
functions. And they accept a list of up to three values. One of these values is node.key
which probably is always different than None
.
That’s where the values (different than None
) are from.
1 Like