Description:
Given array represents Inorder of BST if the array is sorted else not.
Program:
def isSorted(arr):
if (all(arr[i] < arr[i+1] for i in range(len(arr)-1))):
return True
else:
return False
if __name__ == '__main__':
arr = [19, 23, 25, 30, 45]
if isSorted(arr):
print("Array represents Inorder of Binary Search tree")
else:
print("Array doesnot represent Inorder of Binary Search tree")
output:
Array represents Inorder of Binary Search tree

## Comments