def preorder_traversal_iterative(root):
    """
    Return the preorder traversal of nodes' values.

    - Worst Time complexity: O(n)
    - Worst Space complexity: O(n)

    :param root: root node of given binary tree
    :type root: TreeNode or None
    :return: preorder traversal of nodes' values
    :rtype: list[int]
    """
    # basic case
    if root is None:
        return []

    # use stack to traverse
    result = []
    stack = [root]
    while len(stack) != 0:
        root = stack.pop()
        result.append(root.val)
        if root.right is not None:
            stack.append(root.right)
        if root.left is not None:
            stack.append(root.left)

    return result