コード例 #1
0
def move_to(option, struck_type):

    print("\n" + str(Manager.show_item(struck_type)) + "\n")
    print("Numeros a mover\n")
    num = get_input()

    if (Manager.move_item(num, struck_type) is True):

        if (option == "1"):
            strcuk_typ = "lista"
            print(str(Manager.add_item(num, strcuk_typ)) + "\n")
        elif (option == "2"):
            strcuk_typ = "pila"
            print(str(Manager.add_item(num, strcuk_typ)) + "\n")
        elif (option == "3"):
            strcuk_typ = "cola"
            print(str(Manager.add_item(num, strcuk_typ)) + "\n")
        elif (option == "4"):
            strcuk_typ = "arbol binario"
            print(str(Manager.add_item(num, strcuk_typ)) + "\n")
        elif (option == "5"):
            strcuk_typ = "arbol AVL"
            print(str(Manager.add_item(num, strcuk_typ)) + "\n")
        else:
            print("*** Opcion invalida ***")
    else:
        print("*** Error al mover ***")
コード例 #2
0
def execute_operation(operation, struck_type):
    num = 0

    if operation == "Add" or operation == "Delete":

        num = get_input()

        if operation == "Add":
            print(str(Manager.add_item(num, struck_type)))
        else:
            print(str(Manager.delete_item(num, struck_type)))
    else:
        print(str(Manager.show_item(struck_type)))
コード例 #3
0
def execute_operation(operation, struck_type):
    num = 0

    if operation == "Add" or operation == "Delete" or operation == "Move":

        if operation == "Add":

            num = get_input()
            print(str(Manager.add_item(num, struck_type)))

        elif operation == "Move":
            movement_op(struck_type)

        else:
            if struck_type == "lista" or struck_type == "arbol binario" or struck_type == "arbol AVL":
                num = get_input()
                print(str(Manager.delete_item(num, struck_type)))
            else:
                num = 0
                print(str(Manager.delete_item(num, struck_type)))
    else:
        print(str(Manager.show_item(struck_type)))