Пример #1
0
def sortVideos(catalog, size, algorithm):
    sub_list = lt.subList(catalog['videos'], 0, size)

    if algorithm == 'Insertion sort':
        start_time = time.process_time()
        ins.sort(sub_list, cmpVideosbyViews)
        stop_time = time.process_time()

    elif algorithm == 'Selection sort':
        start_time = time.process_time()
        ses.sort(sub_list, cmpVideosbyViews)
        stop_time = time.process_time()

    elif algorithm == 'Shell sort':
        start_time = time.process_time()
        shs.sort(sub_list, cmpVideosbyViews)
        stop_time = time.process_time()

    elif algorithm == 'Merge sort':
        start_time = time.process_time()
        mrg.sort(sub_list, cmpVideosbyViews)
        stop_time = time.process_time()

    elif algorithm == 'Quick sort':
        start_time = time.process_time()
        qck.sort(sub_list, cmpVideosbyViews)
        stop_time = time.process_time()

    elapsed_time_mseg = (stop_time - start_time) * 1000
    return elapsed_time_mseg
Пример #2
0
def sortVideos(lt, sorting):
    if sorting == 0:
        sa.sort(lt, cmpVideosByViews)
    elif sorting == 1:
        ins.sort(lt, cmpVideosByViews)
    elif sorting == 2:
        sel.sort(lt, cmpVideosByViews)
    elif sorting == 3:
        mer.sort(lt, cmpVideosByViews)
    else:
        qck.sort(lt, cmpVideosByViews)
Пример #3
0
def requerimiento3(catalog, categor, tipodeorden, tipo):
    nueva = lt.newList(tipo)
    listae = {}
    for i in range(0, lt.size(catalog['videos'])):
        ele = lt.getElement(catalog['videos'], i)
        if ele['category_id'] == categor and not (ele['title']
                                                  in listae.keys()):
            listae[ele['title']] = 1
            ele['dias'] = 1
            lt.addLast(nueva, ele)
        elif ele['category_id'] == categor and (ele['title'] in listae.keys()):
            listae[ele['title']] = listae[ele['title']] + 1
            ele['dias'] = listae[ele['title']]
            lt.addLast(nueva, ele)
    sublista = nueva.copy()
    start_time = time.process_time()
    if (tipodeorden == "shell"):
        sorted_list = sa.sort(sublista, cmpVideosBytiempo)
    elif (tipodeorden == "insertion"):
        sorted_list = si.sort(sublista, cmpVideosBytiempo)
    elif (tipodeorden == "selection"):
        sorted_list = ss.sort(sublista, cmpVideosBytiempo)
    elif (tipodeorden == "quick"):
        sorted_list = sq.sort(sublista, cmpVideosBytiempo)
    elif (tipodeorden == "merge"):
        sorted_list = sm.sort(sublista, cmpVideosBytiempo)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return sorted_list
Пример #4
0
def requerimiento4(catalog, size, tipodeorden, tagg, tipo):
    nueva = lt.newList(tipo)
    final = lt.newList(tipo)
    listaee = []
    for i in range(0, lt.size(catalog['videos'])):
        ele = lt.getElement(catalog['videos'], i)

        if tagg in ele['tags']:
            lt.addLast(nueva, ele)
    sublista = nueva.copy()
    start_time = time.process_time()
    if (tipodeorden == "shell"):
        sorted_list = sa.sort(sublista, cmpVideosByLikes)
    elif (tipodeorden == "insertion"):
        sorted_list = si.sort(sublista, cmpVideosByLikes)
    elif (tipodeorden == "selection"):
        sorted_list = ss.sort(sublista, cmpVideosByLikes)
    elif (tipodeorden == "quick"):
        sorted_list = sq.sort(sublista, cmpVideosByLikes)
    elif (tipodeorden == "merge"):
        sorted_list = sm.sort(sublista, cmpVideosByLikes)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000

    for i in range(0, lt.size(sorted_list)):
        ete = lt.getElement(sorted_list, i)
        if not (ete['title'] in listaee):
            listaee.append(ete['title'])
            lt.addLast(final, ete)

    return elapsed_time_mseg, final
def sortVideos(catalog, size, tipo):
    try:
        sub_list = lt.subList(catalog["videos"], 1, size)
        sub_list = sub_list.copy()
        if tipo == "Insertion":
            start_time = time.process_time()
            sorted_list = ints.sort(sub_list, cmpVideosbyViews)
            stop_time = time.process_time()

        elif tipo == "Selection":
            start_time = time.process_time()
            sorted_list = sets.sort(sub_list, cmpVideosbyViews)
            stop_time = time.process_time()

        elif tipo == "Shell":
            start_time = time.process_time()
            sorted_list = shls.sort(sub_list, cmpVideosbyViews)
            stop_time = time.process_time()

        elif tipo == "Merge":
            start_time = time.process_time()
            sorted_list = mrgs.sort(sub_list, cmpVideosbyViews)
            stop_time = time.process_time()

        elif tipo == "Quick":
            start_time = time.process_time()
            sorted_list = qcks.sort(sub_list, cmpVideosbyViews)
            stop_time = time.process_time()

        Tiempo_total = (stop_time - start_time) * 1000
        return Tiempo_total, sorted_list

    except IndexError:
        pass
Пример #6
0
def insertionSortVideos(catalog, size):
    sub_list = lt.subList(catalog['videos'], 0, size)
    start_time = time.process_time()
    sorted_list = inss.sort(sub_list, cmpVideosByViews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return elapsed_time_mseg, sorted_list
Пример #7
0
def sortVideos(catalog, size, tipo):
    sub_list = lt.subList(catalog['videos'], 0, size)
    sub_list = sub_list.copy()
    if tipo == 'selection':
        start_time = time.process_time()
        sorted_list = ss.sort(sub_list, cmpVideosByViews)
        stop_time = time.process_time()
        elapsed_time_mseg = (stop_time - start_time) * 1000
        return elapsed_time_mseg, sorted_list

    elif tipo == 'insertion':
        start_time = time.process_time()
        sorted_list = ins.sort(sub_list, cmpVideosByViews)
        stop_time = time.process_time()
        elapsed_time_mseg = (stop_time - start_time) * 1000
        return elapsed_time_mseg, sorted_list

    elif tipo == 'shell':
        start_time = time.process_time()
        sorted_list = sa.sort(sub_list, cmpVideosByViews)
        stop_time = time.process_time()
        elapsed_time_mseg = (stop_time - start_time) * 1000
        return elapsed_time_mseg, sorted_list
    elif tipo == 'quick':
        start_time = time.process_time()
        sorted_list = qs.sort(sub_list, cmpVideosByViews)
        stop_time = time.process_time()
        elapsed_time_mseg = (stop_time - start_time) * 1000
        return elapsed_time_mseg, sorted_list
    elif tipo == 'merge':
        start_time = time.process_time()
        sorted_list = ms.sort(sub_list, cmpVideosByViews)
        stop_time = time.process_time()
        elapsed_time_mseg = (stop_time - start_time) * 1000
        return elapsed_time_mseg, sorted_list
Пример #8
0
def insertionSortVideos(catalog, size, parametro):
    sub_list = lt.subList(catalog, 1, size)
    sub_list = sub_list.copy()
    if parametro == 'trending_days':
        start_time = time.process_time()
        insertionSortList = ins.sort(sub_list, cmpVideosByTrendingdays)
        stop_time = time.process_time()
    elif parametro == 'views':
        start_time = time.process_time()
        insertionSortList = ins.sort(sub_list, cmpVideosByViews)
        stop_time = time.process_time()
    elif parametro == 'likes':
        start_time = time.process_time()
        insertionSortList = ins.sort(sub_list, cmpVideosByLikes)
        stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return (elapsed_time_mseg, insertionSortList)
Пример #9
0
def sortTopViews(filtered_videos, sort):
    start_time = time.process_time()
    if sort == 1:
        print("Insertion sort efectuandose")
        sorted_videos = insertionsort.sort(filtered_videos, cmpVideosByViews)
    elif sort == 2:
        sorted_videos = selectionsort.sort(filtered_videos, cmpVideosByViews)
    elif sort == 3:
        sorted_videos = shellsort.sort(filtered_videos, cmpVideosByViews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time)*1000
    return elapsed_time_mseg, sorted_videos
Пример #10
0
def sortList(tad_lista, metodo, orden='vistas'):
    if orden == "vistas":
        funcion_comp = cmpVideosByViews
    if orden == "video_id":
        funcion_comp = cmpVideosByVideoID
    if orden == "likes":
        funcion_comp = cmpVideosByLikes
    '''
    if orden == "criterio"
        funcion_comp = cmpVideosBy_criterio
    '''
    #se puede hacer mas elegante haciendo un diccionario de funciones como valores y los nombres como llaves
    #tanto lo del criterio como lo de los metodos
    if metodo == "shell":
        shell.sort(tad_lista, funcion_comp)
    if metodo == "selection":
        selection.sort(tad_lista, funcion_comp)
    if metodo == "insertion":
        insertion.sort(tad_lista, funcion_comp)
    if metodo == "quick":
        quick.sort(tad_lista, funcion_comp)
    if metodo == "merge":
        merge.sort(tad_lista, funcion_comp)
Пример #11
0
def sortVideos(list_2, alg):
    start_time = time.process_time()
    if alg == 1:
        sorted_list = sa.sort(list_2, cmpVideosByViews)
    elif alg == 2:
        sorted_list = sel.sort(list_2, cmpVideosByViews)
    elif alg == 3:
        sorted_list = ins.sort(list_2, cmpVideosByViews)
    elif alg == 4:
        sorted_list = merg.sort(list_2, cmpVideosByViews)
    else:
        sorted_list = quick.sort(list_2, cmpVideosByViews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return sorted_list
Пример #12
0
def insertionSort(lista,numero):
    numero=int(numero)
    start_time = time.process_time()
    if numero==1:
        si.sort(lista, cmpVideosByvViewsAscendant)
        stop_time = time.process_time()
    elif numero==2:
        si.sort(lista,cmpVideosByViewsDescendant)
        stop_time = time.process_time()
    elif numero==3:
        si.sort(lista,cmpVideosById)
        stop_time = time.process_time()
    else:
        si.sort(lista,cmpVideosByLikes)
        stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time)*1000
    return lista
Пример #13
0
def sortVideos(catalog, size, iterable_ord):
    start_time = time.process_time()
    sub_list = lt.subList(catalog['title'], 0, size)
    if iterable_ord == "quicksort":
        new_title = qs.sort(sub_list, cmpVideosByViews)
    elif iterable_ord == "mergesort":
        new_title = ms.sort(sub_list, cmpVideosByViews)
    elif iterable_ord == "selectionsort":
        new_title = ss.sort(sub_list, cmpVideosByViews)
    elif iterable_ord == "insertionsort":
        new_title = ins.sort(sub_list, cmpVideosByViews)
    elif iterable_ord == "shellsort":
        new_title = shs.sort(sub_list, cmpVideosByViews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return elapsed_time_mseg, new_title
Пример #14
0
def sortVideos(catalog, size, sortType):
    sub_list = lt.subList(catalog['videos'], 0, size)
    start_time = time.process_time()
    if sortType == 1:
        sorted_list = ss.sort(sub_list, cmpVideosByViews)
    elif sortType == 2:
        sorted_list = ins.sort(sub_list, cmpVideosByViews)
    elif sortType == 3:
        sorted_list = sa.sort(sub_list, cmpVideosByViews)
    elif sortType == 4:
        sorted_list = mg.sort(sub_list, cmpVideosByViews)
    else:
        sorted_list = qs.sort(sub_list, cmpVideosByViews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return elapsed_time_mseg, sorted_list
Пример #15
0
def sortVideos(catalog, size, sort_type):
    sub_list = lt.subList(catalog['videos'], 1, size)
    sub_list = sub_list.copy()
    start_time = time.process_time()
    if sort_type == "se":
        sorted_list = se.sort(sub_list, cmpVideosByViews)
    elif sort_type == "ins":
        sorted_list = ins.sort(sub_list, cmpVideosByViews)
    elif sort_type == "sa":
        sorted_list = sa.sort(sub_list, cmpVideosByViews)
    elif sort_type == "mg":
        sorted_list = mg.sort(sub_list, cmpVideosByViews)
    elif sort_type == "qk":
        sorted_list = qk.sort(sub_list, cmpVideosByViews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return elapsed_time_mseg, sorted_list
Пример #16
0
def tipo_de_orden_model(numero, catalog, size):
    sub_list = lt.subList(catalog['video'], 0, size)
    sub_list = sub_list.copy()
    start_time = time.process_time()
    if numero == 2:
        sorted_list = sa.sort(sub_list, compareviews)
    elif numero == 1:
        sorted_list = isort.sort(sub_list, compareviews)
    elif numero == 3:
        sorted_list = ssort.sort(sub_list, compareviews)
    elif numero == 4:
        sorted_list = quick.sort(sub_list, compareviews)
    else:
        sorted_list = merge.sort(sub_list, compareviews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return elapsed_time_mseg, sorted_list
Пример #17
0
def mejoresVideosPorViews(catalog, numeroDeElementos, algoritmo):
    sub_list = lt.subList(catalog['videos'], 1, numeroDeElementos)
    sub_list = sub_list.copy()
    start_time = time.process_time()
    if algoritmo == "shellsort":
        sorted_list = sa.sort(sub_list, cmpVideosByViews)
    elif algoritmo == "insertionsort":
        sorted_list = ins.sort(sub_list, cmpVideosByViews)
    elif algoritmo == "selectionsort":
        sorted_list = sele.sort(sub_list, cmpVideosByViews)
    elif algoritmo == "mergesort":
        sorted_list = merge.sort(sub_list, cmpVideosByViews)
    elif algoritmo == "quicksort":
        sorted_list = quick.sort(sub_list, cmpVideosByViews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time -start_time)*1000
    return elapsed_time_mseg, sorted_list
Пример #18
0
def sort_type(catalog, size, type):

    sub_list = lt.subList(catalog['videos'], 0, size)
    sub_list = sub_list.copy()
    start_time = time.process_time()
    if type == "insertionsort":
        sorted_list = it.sort(sub_list, cmpVideosByViews)
    elif type == "selectionsort":
        sorted_list = sr.sort(sub_list, cmpVideosByViews)
    elif type == "mergesort":
        sorted_list = mt.sort(sub_list, cmpVideosByViews)
    elif type == "quicksort":
        sorted_list = qt.sort(sub_list, cmpVideosByViews)
    else:
        sorted_list = sa.sort(sub_list, cmpVideosByViews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return elapsed_time_mseg, sorted_list
Пример #19
0
def sortVideos(catalog, size, tiposort):
    sorted_list = []
    sub_list = lt.subList(catalog['videos'], 0, size)
    sub_list = sub_list.copy()
    start_time = time.process_time()
    if tiposort == 1:
        sorted_list = sa.sort(sub_list, cmpVideosByViews)
    elif tiposort == 2:
        sorted_list = insort.sort(sub_list, cmpVideosByViews)
    elif tiposort == 3:
        sorted_list = selsort.sort(sub_list, cmpVideosByViews)
    elif tiposort == 4:
        sorted_list = mrgsort.sort(sub_list, cmpVideosByViews)
    elif tiposort == 5:
        sorted_list = qsort.sort(sub_list, cmpVideosByViews)
    stop_time = time.process_time()
    msegtime = (stop_time - start_time) * 1000

    return msegtime, sorted_list
Пример #20
0
def sortVideosbyViews(catalog, ordenamiento, size):
    """
    Organiza todos los videos de una lista por número de views 
    y retorna una nueva lista organizada
    """
    sortedlist = lt.subList(catalog, 0, size)
    sortedlist = sortedlist.copy()
    start_time = time.process_time()
    if ordenamiento == 1:
        sublist = nsr.sort(sortedlist, cmpVideosByViews)
    elif ordenamiento == 2:
        sublist = stn.sort(sortedlist, cmpVideosByViews)
    elif ordenamiento == 3:
        sublist = shr.sort(sortedlist, cmpVideosByViews)
    elif ordenamiento == 4:
        sublist = qst.sort(sortedlist, cmpVideosByViews)
    elif ordenamiento == 5:
        sublist = mst.sort(sortedlist, cmpVideosByViews)
    return sublist
Пример #21
0
def inefficient_ordering(videos, size, algorithm='shell'):
    if (size > lt.size(videos)):
        size = lt.size(videos)
    temp_list = lt.subList(videos, 0, size)
    temp_list = temp_list.copy()
    start_time = time.process_time()
    if (algorithm == 'shell'):
        temp_list = sa.sort(temp_list, cmpVideosByViews)
    elif (algorithm == 'insertion'):
        temp_list = ie.sort(temp_list, cmpVideosByViews)
    elif (algorithm == 'selection'):
        temp_list = se.sort(temp_list, cmpVideosByViews)
    elif (algorithm == 'quick'):
        temp_list = qk.sort(temp_list, cmpVideosByViews)
    else:
        temp_list = mr.sort(temp_list, cmpVideosByViews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return elapsed_time_mseg, temp_list
Пример #22
0
def ordenarCatalogo(catalog, tipo):

    if tipo == 'selection':
        start_time = time.process_time()
        sorted_list = ss.sort(catalog, cmpVideosByViews)
        stop_time = time.process_time()
        elapsed_time_mseg = (stop_time - start_time) * 1000
    elif tipo == 'insertion':
        start_time = time.process_time()
        sorted_list = ins.sort(catalog, cmpVideosByViews)
        stop_time = time.process_time()
        elapsed_time_mseg = (stop_time - start_time) * 1000
    elif tipo == 'shell':
        start_time = time.process_time()
        sorted_list = sa.sort(catalog, cmpVideosByViews)
        stop_time = time.process_time()
        elapsed_time_mseg = (stop_time - start_time) * 1000

    return sorted_list, elapsed_time_mseg
Пример #23
0
def sortVideosTime(catalog, size, sort_type):
    sub_list = lt.subList(catalog['videos'], 0, size)
    sub_list = sub_list.copy()
    start_time = time.process_time()
    sorted_list = None
    if sort_type == 'selection':
        sorted_list = selectionsort.sort(sub_list, cmpVideosByTime)
    elif sort_type == 'insertion':
        sorted_list = insertionsort.sort(sub_list, cmpVideosByTime)
    elif sort_type == 'shell':
        sorted_list = shellsort.sort(sub_list, cmpVideosByTime)
    elif sort_type == 'merge':
        sorted_list = mergesort.sort(sub_list, cmpVideosByTime)
    elif sort_type == 'quick':
        sorted_list = quicksort.sort(sub_list, cmpVideosByTime)
    else:
        print('Invalid sorting algorithm, try selection, insertion or shell')
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return elapsed_time_mseg, sorted_list
Пример #24
0
def requerimiento1(catalog, size, tipodeorden, categ, pais, tipo):
    nueva = lt.newList(tipo)
    for i in range(0, lt.size(catalog['videos'])):
        ele = lt.getElement(catalog['videos'], i)
        if ele['category_id'] == categ and ele['country'] == pais:
            lt.addLast(nueva, ele)
    sublista = nueva.copy()
    start_time = time.process_time()
    if (tipodeorden == "shell"):
        sorted_list = sa.sort(sublista, cmpVideosByViews)
    elif (tipodeorden == "insertion"):
        sorted_list = si.sort(sublista, cmpVideosByViews)
    elif (tipodeorden == "selection"):
        sorted_list = ss.sort(sublista, cmpVideosByViews)
    elif (tipodeorden == "quick"):
        sorted_list = sq.sort(sublista, cmpVideosByViews)
    elif (tipodeorden == "merge"):
        sorted_list = sm.sort(sublista, cmpVideosByViews)
    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return elapsed_time_mseg, sorted_list
Пример #25
0
def sortVideos(catalog, num, orden):
    sub_list = lt.subList(catalog['video'], 0, num)
    sub_list = sub_list.copy()
    start_time = time.process_time()
    if orden.lower() == "selection":
        sorted_list = ss.sort(sub_list, cmpVideosByViews)

    elif orden.lower() == "insertion":
        sorted_list = ins.sort(sub_list, cmpVideosByViews)

    elif orden.lower() == "shell":
        sorted_list = sa.sort(sub_list, cmpVideosByViews)

    elif orden.lower() == "quick":
        sorted_list = qs.sort(sub_list, cmpVideosByViews)

    elif orden.lower() == "merge":
        sorted_list = ms.sort(sub_list, cmpVideosByViews)

    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return [elapsed_time_mseg, sorted_list]
Пример #26
0
def Ordenamientos(tipo, dicci, size):

    start_time = time.process_time()
    sub_list = lt.subList(dicci["videos"], 0, size)
    sub_list = sub_list.copy()

    if tipo == "shell":
        x = sa.sort(sub_list, cmpVideosByViews)
    elif tipo == "selection":
        x = sel.sort(sub_list, cmpVideosByViews)
    elif tipo == "insertion":
        x = ins.sort(sub_list, cmpVideosByViews)
    elif tipo == "quick":
        x = qk.sort(sub_list, cmpVideosByViews)
    elif tipo == "merge":
        x = mg.sort(sub_list, cmpVideosByViews)
    else:
        print("Este tipo de ordenamiento no existe")

    stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    return x, elapsed_time_mseg
Пример #27
0
def sortVideos(catalog, pais, categoria):
    algoritmo = "shell"
    pais = obtener_videos_pais(catalog, pais)
    lista_pais = pais['videos']
    lista_ordenar = categoria_en_lista(categoria, lista_pais, cmpVideosByViews,
                                       catalog)
    tamaño = lt.size(lista_ordenar)
    sub_list = lt.subList(lista_ordenar, 1, tamaño)
    sub_list = sub_list.copy()
    if algoritmo == "shell":
        sorted_list = sa.sort(sub_list, cmpVideosByViews)
    elif algoritmo == "selection":
        sorted_list = ss.sort(sub_list, cmpVideosByViews)
    elif algoritmo == "insertion":
        sorted_list = ins.sort(sub_list, cmpVideosByViews)
    elif algoritmo == "merge":
        sorted_list = ms.sort(sub_list, cmpVideosByViews)
    elif algoritmo == "quick":
        sorted_list = qs.sort(sub_list, cmpVideosByViews)
    else:
        return "Vuelva a escribir en minusculas"
    return sorted_list
Пример #28
0
def firstReq(catalog, country, category, data_size, algorithm):
    "Completa el requerimiento 1"
    data_sublist = lt.subList(catalog["videos"], 0, data_size)
    data_sublist = data_sublist.copy()
    for video in data_sublist["elements"]:
        if video["country"] != country and video["category_id"] != category:
            data_sublist["elements"].remove(video)
    print(data_sublist["type"])
    if algorithm == 0:
        start_time = time.process_time()
        sorted_list = sel.sort(data_sublist["elements"], cmpVideosByViews)
        stop_time = time.process_time()
    elif algorithm == 1:
        start_time = time.process_time()
        sorted_list = ins.sort(data_sublist["elements"], cmpVideosByViews)
        stop_time = time.process_time()
    elif algorithm == 2:
        start_time = time.process_time()
        sorted_list = shell.sort(data_sublist["elements"], cmpVideosByViews)
        stop_time = time.process_time()
    elapsed_time_mseg = (stop_time - start_time) * 1000
    #sorted_top_n = lt.subList(sorted_list, 0, n_videos)
    return [sorted_top_n, start_time, stop_time]
def insertionVideos(catalog):
    ins.sort(catalog["videos"], compareviews)
def test_selection_random(randomlist):
    olist = sa.sort(randomlist, cmpfunction)
    for elem in lt.iterator(olist):
        print(elem)