To create a Tree with n levels . We always insert new node to left if it is less than previous value .
def createNLevelTree ( arr , n ) : NEW_LINE INDENT root = newNode ( arr [ 0 ] ) NEW_LINE temp = root NEW_LINE for i in range ( 1 , n ) : NEW_LINE INDENT if ( temp . key > arr [ i ] ) : NEW_LINE INDENT temp . left = newNode ( arr [ i ] ) NEW_LINE temp = temp . left NEW_LINE DEDENT else : NEW_LINE INDENT temp . right = newNode ( arr [ i ] ) NEW_LINE temp = temp . right NEW_LINE DEDENT DEDENT return root NEW_LINE DEDENT