Which of the following is false about a binary search tree? code example
Example 1: binary tree vs binary search tree
Binary tree - each node can have at most 2 nodes, Binary Search tree - is a binary tree and put smaller values on the left and larger values on the right of the root.
Example 2: binary search tree
# Driver Code
arr = [ 2, 3, 4, 10, 40 ]
x = 10
# Function call
result = binarySearch(arr, 0, len(arr)-1, x)
if result != -1:
print ("Element is present at index % d" % result)
else:
print ("Element is not present in array")