Exemple #1
0
def build_bst_from_sorted_doubly_list_wrapper(executor, l):
    input_list = None
    for v in reversed(l):
        input_list = DoublyListNode(v, next=input_list)
        if input_list.next != None:
            input_list.next.prev = input_list

    input_list = executor.run(
        functools.partial(build_bst_from_sorted_doubly_list, input_list,
                          len(l)))

    it = iter(l)
    compare_vector_and_tree(input_list, it)
    if next(it, None) is not None:
        raise TestFailure("Too many l in the tree")
def build_bst_from_sorted_doubly_list_wrapper(timer, L):
    l = None
    for v in reversed(L):
        l = DoublyListNode(v, next=l)
        if l.next != None:
            l.next.prev = l

    timer.start()
    l = build_bst_from_sorted_doubly_list(l, len(L))
    timer.stop()

    it = iter(L)
    compare_vector_and_tree(l, it)
    if next(it, None) is not None:
        raise TestFailureException("Too many L in the tree")
Exemple #3
0
def merge_two_sorted_lists(
        L1, L2: Optional[DoublyListNode]) -> Optional[DoublyListNode]:

    dumy_head = DoublyListNode()
    return dumy_head.next