human
Check if each internal node of a BST has exactly one child | Check if each internal node of BST has only one child.
driver program to test above function"
Solution in Python:
assistant
#Here is code to check if each internal node of a BST has exactly one child and the other steps required.
 def hasOnlyOneChild ( pre , size ) :
	nextDiff = 0 ; lastDiff = 0
	for i in range ( size - 1 ) :
		nextDiff = pre [ i ] - pre [ i + 1 ]
		lastDiff = pre [ i ] - pre [ size - 1 ]
		if nextDiff * lastDiff < 0 :
			return False
	return True
if __name__ == " _ _ main _ _ " :
	pre = [ 8 , 3 , 5 , 7 , 6 ]
	size = len ( pre )
	if ( hasOnlyOneChild ( pre , size ) == True ) :
		print ( " Yes " )
	else :
		print ( " No " )