def _dump_permutation_of_source_array(candidate_nodes, visited_nodes):
    if (len(candidate_nodes) == 0):
        dump_nodes(visited_nodes)
        return
    n = len(candidate_nodes)
    for i in range(0, n):
        _visited_nodes = copy.deepcopy(visited_nodes)
        _candidate_nodes = copy.deepcopy(candidate_nodes)
        _visited_nodes.append(_candidate_nodes[i])
        _candidate_nodes.remove(_candidate_nodes[i])
        node = candidate_nodes[i]
        if (node.left != None):
            _candidate_nodes.insert(0, node.left)
        if (node.right != None):
            _candidate_nodes.insert(0, node.right)
        _dump_permutation_of_source_array(_candidate_nodes, _visited_nodes)
def _dump_permutation_of_source_array(candidate_nodes, visited_nodes):
    if (len(candidate_nodes) == 0):
        dump_nodes(visited_nodes)
        return
    n = len(candidate_nodes)
    for i in range(0, n):
        _visited_nodes = copy.deepcopy(visited_nodes)
        _candidate_nodes = copy.deepcopy(candidate_nodes)
        _visited_nodes.append(_candidate_nodes[i])
        _candidate_nodes.remove(_candidate_nodes[i])
        node = candidate_nodes[i]
        if (node.left != None):
            _candidate_nodes.insert(0, node.left)
        if (node.right != None):
            _candidate_nodes.insert(0, node.right)
        _dump_permutation_of_source_array(_candidate_nodes, _visited_nodes)