<garvit244>144_1.py
def preorderTraversal( root):
    if not root:
        return []
    
    stack, result = [root], []
    while stack:
        element = stack.pop()
        result.append(element.val)
    
        if element.right:
            stack.append(element.right)
        if element.left:
            stack.append(element.left)
    
    return result
def sample_funcname ( var_0 ) :
    if not var_0 :
        return [ ]
    var_1 , var_2 = [ var_0 ] , [ ]
    while var_1 :
        var_4 = var_1.pop ( )
        var_2.append ( var_4.val )
        if var_4.right :
            var_1.append ( var_4.right )
        if var_4.left :
            var_1.append ( var_4.left )
    return var_2
