@njit
def list_preorder(node):
 out = []
 stack = make_stack(node)
 while (stack is not None):
  node = stack.data
  out.append(node.data)
  stack = pop(stack)
  if (node.right is not None):
   stack = push(stack, node.right)
  if (node.left is not None):
   stack = push(stack, node.left)
 return out

@ njit def list_preorder ( node ) : out = [ ] stack = make_stack ( node ) while ( stack is not None ) : node = stack . data out . append ( node . data ) stack = pop ( stack ) if ( node . right is not None ) : stack = push ( stack , node . right ) if ( node . left is not None ) : stack = push ( stack , node . left ) return out
returns a list of the data by preorder traversing the tree .