Let us create following BST 50 / \ 30 70 / \ / \ 20 40 60 80
root = None NEW_LINE root = insert ( root , 50 ) NEW_LINE insert ( root , 30 ) NEW_LINE insert ( root , 20 ) NEW_LINE insert ( root , 40 ) NEW_LINE insert ( root , 70 ) NEW_LINE insert ( root , 60 ) NEW_LINE insert ( root , 80 ) NEW_LINE for k in range ( 1 , 8 ) : NEW_LINE INDENT print ( KSmallestUsingMorris ( root , k ) , end = " ▁ " ) NEW_LINE DEDENT