20 / \ 8 22 / \ 4 12 / \ 10 14
root = None NEW_LINE root = insert ( root , 20 ) NEW_LINE root = insert ( root , 8 ) NEW_LINE root = insert ( root , 4 ) NEW_LINE root = insert ( root , 12 ) NEW_LINE root = insert ( root , 10 ) NEW_LINE root = insert ( root , 14 ) NEW_LINE root = insert ( root , 22 ) NEW_LINE k = [ 3 ] NEW_LINE print ( ksmallestElementSum ( root , k ) ) NEW_LINE