[ { "label": "time", "kind": 6, "isExtraImport": true, "importPath": "time", "description": "time", "detail": "time", "documentation": {} }, { "label": "randint", "importPath": "random", "description": "random", "isExtraImport": true, "detail": "random", "documentation": {} }, { "label": "heap", "kind": 6, "isExtraImport": true, "importPath": "heap", "description": "heap", "detail": "heap", "documentation": {} }, { "label": "merge", "importPath": "merge", "description": "merge", "isExtraImport": true, "detail": "merge", "documentation": {} }, { "label": "heapify", "kind": 2, "importPath": "heap", "description": "heap", "peekOfCode": "def heapify(lista, n, i):\n\tlargest = i # Initialize largest as root\n\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n# See if left child of root exists and is\n# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n# See if right child of root exists and is\n# greater than root", "detail": "heap", "documentation": {} }, { "label": "\tlargest", "kind": 5, "importPath": "heap", "description": "heap", "peekOfCode": "\tlargest = i # Initialize largest as root\n\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n# See if left child of root exists and is\n# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n# See if right child of root exists and is\n# greater than root\n\tif r < n and lista[largest] < lista[r]:", "detail": "heap", "documentation": {} }, { "label": "\tl", "kind": 5, "importPath": "heap", "description": "heap", "peekOfCode": "\tl = 2 * i + 1 # left = 2*i + 1\n\tr = 2 * i + 2 # right = 2*i + 2\n# See if left child of root exists and is\n# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n# See if right child of root exists and is\n# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r", "detail": "heap", "documentation": {} }, { "label": "\tr", "kind": 5, "importPath": "heap", "description": "heap", "peekOfCode": "\tr = 2 * i + 2 # right = 2*i + 2\n# See if left child of root exists and is\n# greater than root\n\tif l < n and lista[i] < lista[l]:\n\t\tlargest = l\n# See if right child of root exists and is\n# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n# Change root, if needed", "detail": "heap", "documentation": {} }, { "label": "\t\tlargest", "kind": 5, "importPath": "heap", "description": "heap", "peekOfCode": "\t\tlargest = l\n# See if right child of root exists and is\n# greater than root\n\tif r < n and lista[largest] < lista[r]:\n\t\tlargest = r\n# Change root, if needed\n\tif largest != i:\n\t\t(lista[i], lista[largest]) = (lista[largest], lista[i]) # swap\n# Heapify the root.\n\t\theapify(lista, n, largest)", "detail": "heap", "documentation": {} }, { "label": "\t\tlargest", "kind": 5, "importPath": "heap", "description": "heap", "peekOfCode": "\t\tlargest = r\n# Change root, if needed\n\tif largest != i:\n\t\t(lista[i], lista[largest]) = (lista[largest], lista[i]) # swap\n# Heapify the root.\n\t\theapify(lista, n, largest)", "detail": "heap", "documentation": {} }, { "label": "merge", "kind": 2, "importPath": "merge", "description": "merge", "peekOfCode": "def merge(arr, l, m, r):\n\tn1 = m - l + 1\n\tn2 = r - m\n\t# create temp arrays\n\tL = [0] * (n1)\n\tR = [0] * (n2)\n\t# Copy data to temp arrays L[] and R[]\n\tfor i in range(0, n1):\n\t\tL[i] = arr[l + i]\n\tfor j in range(0, n2):", "detail": "merge", "documentation": {} }, { "label": "\tn1", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\tn1 = m - l + 1\n\tn2 = r - m\n\t# create temp arrays\n\tL = [0] * (n1)\n\tR = [0] * (n2)\n\t# Copy data to temp arrays L[] and R[]\n\tfor i in range(0, n1):\n\t\tL[i] = arr[l + i]\n\tfor j in range(0, n2):\n\t\tR[j] = arr[m + 1 + j]", "detail": "merge", "documentation": {} }, { "label": "\tn2", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\tn2 = r - m\n\t# create temp arrays\n\tL = [0] * (n1)\n\tR = [0] * (n2)\n\t# Copy data to temp arrays L[] and R[]\n\tfor i in range(0, n1):\n\t\tL[i] = arr[l + i]\n\tfor j in range(0, n2):\n\t\tR[j] = arr[m + 1 + j]\n\t# Merge the temp arrays back into arr[l..r]", "detail": "merge", "documentation": {} }, { "label": "\tL", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\tL = [0] * (n1)\n\tR = [0] * (n2)\n\t# Copy data to temp arrays L[] and R[]\n\tfor i in range(0, n1):\n\t\tL[i] = arr[l + i]\n\tfor j in range(0, n2):\n\t\tR[j] = arr[m + 1 + j]\n\t# Merge the temp arrays back into arr[l..r]\n\ti = 0\t # Initial index of first subarray\n\tj = 0\t # Initial index of second subarray", "detail": "merge", "documentation": {} }, { "label": "\tR", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\tR = [0] * (n2)\n\t# Copy data to temp arrays L[] and R[]\n\tfor i in range(0, n1):\n\t\tL[i] = arr[l + i]\n\tfor j in range(0, n2):\n\t\tR[j] = arr[m + 1 + j]\n\t# Merge the temp arrays back into arr[l..r]\n\ti = 0\t # Initial index of first subarray\n\tj = 0\t # Initial index of second subarray\n\tk = l\t # Initial index of merged subarray", "detail": "merge", "documentation": {} }, { "label": "\t\tL[i]", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\t\tL[i] = arr[l + i]\n\tfor j in range(0, n2):\n\t\tR[j] = arr[m + 1 + j]\n\t# Merge the temp arrays back into arr[l..r]\n\ti = 0\t # Initial index of first subarray\n\tj = 0\t # Initial index of second subarray\n\tk = l\t # Initial index of merged subarray\n\twhile i < n1 and j < n2:\n\t\tif L[i] <= R[j]:\n\t\t\tarr[k] = L[i]", "detail": "merge", "documentation": {} }, { "label": "\t\tR[j]", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\t\tR[j] = arr[m + 1 + j]\n\t# Merge the temp arrays back into arr[l..r]\n\ti = 0\t # Initial index of first subarray\n\tj = 0\t # Initial index of second subarray\n\tk = l\t # Initial index of merged subarray\n\twhile i < n1 and j < n2:\n\t\tif L[i] <= R[j]:\n\t\t\tarr[k] = L[i]\n\t\t\ti += 1\n\t\telse:", "detail": "merge", "documentation": {} }, { "label": "\ti", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\ti = 0\t # Initial index of first subarray\n\tj = 0\t # Initial index of second subarray\n\tk = l\t # Initial index of merged subarray\n\twhile i < n1 and j < n2:\n\t\tif L[i] <= R[j]:\n\t\t\tarr[k] = L[i]\n\t\t\ti += 1\n\t\telse:\n\t\t\tarr[k] = R[j]\n\t\t\tj += 1", "detail": "merge", "documentation": {} }, { "label": "\tj", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\tj = 0\t # Initial index of second subarray\n\tk = l\t # Initial index of merged subarray\n\twhile i < n1 and j < n2:\n\t\tif L[i] <= R[j]:\n\t\t\tarr[k] = L[i]\n\t\t\ti += 1\n\t\telse:\n\t\t\tarr[k] = R[j]\n\t\t\tj += 1\n\t\tk += 1", "detail": "merge", "documentation": {} }, { "label": "\tk", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\tk = l\t # Initial index of merged subarray\n\twhile i < n1 and j < n2:\n\t\tif L[i] <= R[j]:\n\t\t\tarr[k] = L[i]\n\t\t\ti += 1\n\t\telse:\n\t\t\tarr[k] = R[j]\n\t\t\tj += 1\n\t\tk += 1\n\t# Copy the remaining elements of L[], if there", "detail": "merge", "documentation": {} }, { "label": "\t\t\tarr[k]", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\t\t\tarr[k] = L[i]\n\t\t\ti += 1\n\t\telse:\n\t\t\tarr[k] = R[j]\n\t\t\tj += 1\n\t\tk += 1\n\t# Copy the remaining elements of L[], if there\n\t# are any\n\twhile i < n1:\n\t\tarr[k] = L[i]", "detail": "merge", "documentation": {} }, { "label": "\t\t\tarr[k]", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\t\t\tarr[k] = R[j]\n\t\t\tj += 1\n\t\tk += 1\n\t# Copy the remaining elements of L[], if there\n\t# are any\n\twhile i < n1:\n\t\tarr[k] = L[i]\n\t\ti += 1\n\t\tk += 1\n\t# Copy the remaining elements of R[], if there", "detail": "merge", "documentation": {} }, { "label": "\t\tarr[k]", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\t\tarr[k] = L[i]\n\t\ti += 1\n\t\tk += 1\n\t# Copy the remaining elements of R[], if there\n\t# are any\n\twhile j < n2:\n\t\tarr[k] = R[j]\n\t\tj += 1\n\t\tk += 1\n# l is for left index and r is right index of the", "detail": "merge", "documentation": {} }, { "label": "\t\tarr[k]", "kind": 5, "importPath": "merge", "description": "merge", "peekOfCode": "\t\tarr[k] = R[j]\n\t\tj += 1\n\t\tk += 1\n# l is for left index and r is right index of the\n# sub-array of arr to be sorted", "detail": "merge", "documentation": {} }, { "label": "mergeSort", "kind": 2, "importPath": "sorting", "description": "sorting", "peekOfCode": "def mergeSort(lista, l, r):\n\tif l < r:\n # Same as (l+r)//2, but avoids overflow for\n # large l and h\n\t\tm = l+(r-l)//2\n # Sort first and second halves\n\t\tmergeSort(lista, l, m)\n\t\tmergeSort(lista, m+1, r)\n\t\tmerge(lista, l, m, r)\n''' Luis Andrés López Mañán", "detail": "sorting", "documentation": {} }, { "label": "heapSort", "kind": 2, "importPath": "sorting", "description": "sorting", "peekOfCode": "def heapSort(lista):\n\t# Se busca el tamaño de la lista\n\tn = len(lista)\n\theap.heapify(lista,n,0)\n\t\"\"\" Se crea un heap máximo y el último padre estará en\n\t\tla posición h1, i.e., la mitad del tamaño de la lista.\n\t\tPor lo tanto, ese sería el comienzo. \n\t\"\"\"\n\th1 = (n // 2) - 1\n\tfor i in range(h1, -1, -1):", "detail": "sorting", "documentation": {} }, { "label": "quickSort", "kind": 2, "importPath": "sorting", "description": "sorting", "peekOfCode": "def quickSort(lista):\n\t# definan el algoritmo de ordenamiento quicksort\n\telements = len(lista)\n # Base case\n\tif elements < 2:\n\t\treturn lista\n\tcurrent_position = 0 #Position of the partitioning element\n\tfor i in range(1, elements): #Partitioning loop\n\t\tif lista[i] <= lista[0]:\n\t\t\tcurrent_position += 1", "detail": "sorting", "documentation": {} }, { "label": "shellSort", "kind": 2, "importPath": "sorting", "description": "sorting", "peekOfCode": "def shellSort(lista):\n\t# definan el algoritmo de ordenamiento shellsort\n\t# determening the size of the list and calculates the gap value. \n\tn = len(lista)\n\tgap = n // 2\n\t# this algorithm will run until gap reaches 1 \n\twhile gap > 0:\n\t\tfor i in range(gap, n):\n\t\t\ttemp = lista[i] # storing all items from the list into temp \n\t\t\tj = i ", "detail": "sorting", "documentation": {} }, { "label": "\t\tm", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\t\tm = l+(r-l)//2\n # Sort first and second halves\n\t\tmergeSort(lista, l, m)\n\t\tmergeSort(lista, m+1, r)\n\t\tmerge(lista, l, m, r)\n''' Luis Andrés López Mañán\n Program written by hand as a draft on 09/19/2022\n Credit goes to GeeksForGeeks\n Link: https://www.geeksforgeeks.org/python-program-for-heap-sort/\n Last access on 09/19/2022", "detail": "sorting", "documentation": {} }, { "label": "\tn", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tn = len(lista)\n\theap.heapify(lista,n,0)\n\t\"\"\" Se crea un heap máximo y el último padre estará en\n\t\tla posición h1, i.e., la mitad del tamaño de la lista.\n\t\tPor lo tanto, ese sería el comienzo. \n\t\"\"\"\n\th1 = (n // 2) - 1\n\tfor i in range(h1, -1, -1):\n\t\theap.heapify(lista, n, i)\n\t# Se extrae los elementos uno a uno", "detail": "sorting", "documentation": {} }, { "label": "\th1", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\th1 = (n // 2) - 1\n\tfor i in range(h1, -1, -1):\n\t\theap.heapify(lista, n, i)\n\t# Se extrae los elementos uno a uno\n\th2 = n - 1\n\tfor i in range(h2, 0, -1):\n\t\t# Se intercambia, luego se hace heapify\n\t\tlista[i], lista[0] = lista[0], lista[i]\n\t\theap.heapify(lista, 0, i)\n\treturn lista", "detail": "sorting", "documentation": {} }, { "label": "\th2", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\th2 = n - 1\n\tfor i in range(h2, 0, -1):\n\t\t# Se intercambia, luego se hace heapify\n\t\tlista[i], lista[0] = lista[0], lista[i]\n\t\theap.heapify(lista, 0, i)\n\treturn lista\ndef quickSort(lista):\n\t# definan el algoritmo de ordenamiento quicksort\n\telements = len(lista)\n # Base case", "detail": "sorting", "documentation": {} }, { "label": "\telements", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\telements = len(lista)\n # Base case\n\tif elements < 2:\n\t\treturn lista\n\tcurrent_position = 0 #Position of the partitioning element\n\tfor i in range(1, elements): #Partitioning loop\n\t\tif lista[i] <= lista[0]:\n\t\t\tcurrent_position += 1\n\t\t\ttemp = lista[i]\n\t\t\tlista[i] = lista[current_position]", "detail": "sorting", "documentation": {} }, { "label": "\tcurrent_position", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tcurrent_position = 0 #Position of the partitioning element\n\tfor i in range(1, elements): #Partitioning loop\n\t\tif lista[i] <= lista[0]:\n\t\t\tcurrent_position += 1\n\t\t\ttemp = lista[i]\n\t\t\tlista[i] = lista[current_position]\n\t\t\tlista[current_position] = temp\n\ttemp = lista[0]\n\tlista[0] = lista[current_position] \n\tlista[current_position] = temp #Brings pivot to it's appropriate position", "detail": "sorting", "documentation": {} }, { "label": "\t\t\ttemp", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\t\t\ttemp = lista[i]\n\t\t\tlista[i] = lista[current_position]\n\t\t\tlista[current_position] = temp\n\ttemp = lista[0]\n\tlista[0] = lista[current_position] \n\tlista[current_position] = temp #Brings pivot to it's appropriate position\n\tleft = quickSort(lista[0:current_position]) #Sorts the elements to the left of pivot\n\tright = quickSort(lista[current_position+1:elements]) #sorts the elements to the right of pivot\n\tlista = left + [lista[current_position]] + right #Merging everything together\n\treturn lista", "detail": "sorting", "documentation": {} }, { "label": "\t\t\tlista[i]", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\t\t\tlista[i] = lista[current_position]\n\t\t\tlista[current_position] = temp\n\ttemp = lista[0]\n\tlista[0] = lista[current_position] \n\tlista[current_position] = temp #Brings pivot to it's appropriate position\n\tleft = quickSort(lista[0:current_position]) #Sorts the elements to the left of pivot\n\tright = quickSort(lista[current_position+1:elements]) #sorts the elements to the right of pivot\n\tlista = left + [lista[current_position]] + right #Merging everything together\n\treturn lista\n''' ", "detail": "sorting", "documentation": {} }, { "label": "\t\t\tlista[current_position]", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\t\t\tlista[current_position] = temp\n\ttemp = lista[0]\n\tlista[0] = lista[current_position] \n\tlista[current_position] = temp #Brings pivot to it's appropriate position\n\tleft = quickSort(lista[0:current_position]) #Sorts the elements to the left of pivot\n\tright = quickSort(lista[current_position+1:elements]) #sorts the elements to the right of pivot\n\tlista = left + [lista[current_position]] + right #Merging everything together\n\treturn lista\n''' \n\tThis algorithm was taken from: https://www.programiz.com/dsa/shell-sort ", "detail": "sorting", "documentation": {} }, { "label": "\ttemp", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\ttemp = lista[0]\n\tlista[0] = lista[current_position] \n\tlista[current_position] = temp #Brings pivot to it's appropriate position\n\tleft = quickSort(lista[0:current_position]) #Sorts the elements to the left of pivot\n\tright = quickSort(lista[current_position+1:elements]) #sorts the elements to the right of pivot\n\tlista = left + [lista[current_position]] + right #Merging everything together\n\treturn lista\n''' \n\tThis algorithm was taken from: https://www.programiz.com/dsa/shell-sort \n\tand was adapted in order to work for this assigment.", "detail": "sorting", "documentation": {} }, { "label": "\tlista[0]", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tlista[0] = lista[current_position] \n\tlista[current_position] = temp #Brings pivot to it's appropriate position\n\tleft = quickSort(lista[0:current_position]) #Sorts the elements to the left of pivot\n\tright = quickSort(lista[current_position+1:elements]) #sorts the elements to the right of pivot\n\tlista = left + [lista[current_position]] + right #Merging everything together\n\treturn lista\n''' \n\tThis algorithm was taken from: https://www.programiz.com/dsa/shell-sort \n\tand was adapted in order to work for this assigment.\n'''", "detail": "sorting", "documentation": {} }, { "label": "\tlista[current_position]", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tlista[current_position] = temp #Brings pivot to it's appropriate position\n\tleft = quickSort(lista[0:current_position]) #Sorts the elements to the left of pivot\n\tright = quickSort(lista[current_position+1:elements]) #sorts the elements to the right of pivot\n\tlista = left + [lista[current_position]] + right #Merging everything together\n\treturn lista\n''' \n\tThis algorithm was taken from: https://www.programiz.com/dsa/shell-sort \n\tand was adapted in order to work for this assigment.\n'''\ndef shellSort(lista):", "detail": "sorting", "documentation": {} }, { "label": "\tleft", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tleft = quickSort(lista[0:current_position]) #Sorts the elements to the left of pivot\n\tright = quickSort(lista[current_position+1:elements]) #sorts the elements to the right of pivot\n\tlista = left + [lista[current_position]] + right #Merging everything together\n\treturn lista\n''' \n\tThis algorithm was taken from: https://www.programiz.com/dsa/shell-sort \n\tand was adapted in order to work for this assigment.\n'''\ndef shellSort(lista):\n\t# definan el algoritmo de ordenamiento shellsort", "detail": "sorting", "documentation": {} }, { "label": "\tright", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tright = quickSort(lista[current_position+1:elements]) #sorts the elements to the right of pivot\n\tlista = left + [lista[current_position]] + right #Merging everything together\n\treturn lista\n''' \n\tThis algorithm was taken from: https://www.programiz.com/dsa/shell-sort \n\tand was adapted in order to work for this assigment.\n'''\ndef shellSort(lista):\n\t# definan el algoritmo de ordenamiento shellsort\n\t# determening the size of the list and calculates the gap value. ", "detail": "sorting", "documentation": {} }, { "label": "\tlista", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tlista = left + [lista[current_position]] + right #Merging everything together\n\treturn lista\n''' \n\tThis algorithm was taken from: https://www.programiz.com/dsa/shell-sort \n\tand was adapted in order to work for this assigment.\n'''\ndef shellSort(lista):\n\t# definan el algoritmo de ordenamiento shellsort\n\t# determening the size of the list and calculates the gap value. \n\tn = len(lista)", "detail": "sorting", "documentation": {} }, { "label": "\tn", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tn = len(lista)\n\tgap = n // 2\n\t# this algorithm will run until gap reaches 1 \n\twhile gap > 0:\n\t\tfor i in range(gap, n):\n\t\t\ttemp = lista[i] # storing all items from the list into temp \n\t\t\tj = i \n\t\t\t# compares the number in temp with the 0th possition (start of list)\n\t\t\t# if temp is larger than the first element then we swap them\n\t\t\twhile j >= gap and lista[j - gap] > temp: ", "detail": "sorting", "documentation": {} }, { "label": "\tgap", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tgap = n // 2\n\t# this algorithm will run until gap reaches 1 \n\twhile gap > 0:\n\t\tfor i in range(gap, n):\n\t\t\ttemp = lista[i] # storing all items from the list into temp \n\t\t\tj = i \n\t\t\t# compares the number in temp with the 0th possition (start of list)\n\t\t\t# if temp is larger than the first element then we swap them\n\t\t\twhile j >= gap and lista[j - gap] > temp: \n\t\t\t\tlista[j] = lista[j - gap]", "detail": "sorting", "documentation": {} }, { "label": "\t\t\ttemp", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\t\t\ttemp = lista[i] # storing all items from the list into temp \n\t\t\tj = i \n\t\t\t# compares the number in temp with the 0th possition (start of list)\n\t\t\t# if temp is larger than the first element then we swap them\n\t\t\twhile j >= gap and lista[j - gap] > temp: \n\t\t\t\tlista[j] = lista[j - gap]\n\t\t\t\tj -= gap\n\t\t\tlista[j] = temp\n\t\tgap = gap // 2 # decreases the gap to continue the loop \n\treturn lista", "detail": "sorting", "documentation": {} }, { "label": "\t\t\tj", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\t\t\tj = i \n\t\t\t# compares the number in temp with the 0th possition (start of list)\n\t\t\t# if temp is larger than the first element then we swap them\n\t\t\twhile j >= gap and lista[j - gap] > temp: \n\t\t\t\tlista[j] = lista[j - gap]\n\t\t\t\tj -= gap\n\t\t\tlista[j] = temp\n\t\tgap = gap // 2 # decreases the gap to continue the loop \n\treturn lista\nmaxValor=1000 \t#define el valor maximo de los elementos de la lista", "detail": "sorting", "documentation": {} }, { "label": "\t\t\t\tlista[j]", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\t\t\t\tlista[j] = lista[j - gap]\n\t\t\t\tj -= gap\n\t\t\tlista[j] = temp\n\t\tgap = gap // 2 # decreases the gap to continue the loop \n\treturn lista\nmaxValor=1000 \t#define el valor maximo de los elementos de la lista\nlargoLista=1000 #define el largo de las listas a ordenar\nveces=100 \t\t#define las veces que se va a hacer el ordenamiento \nacumulaMerge=0 \t#variable para acumular el tiempo de ejecucion del mergesort\nacumulaHeap=0 \t#variable para acumular el tiempo de ejecucion del heapsort", "detail": "sorting", "documentation": {} }, { "label": "\t\t\tlista[j]", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\t\t\tlista[j] = temp\n\t\tgap = gap // 2 # decreases the gap to continue the loop \n\treturn lista\nmaxValor=1000 \t#define el valor maximo de los elementos de la lista\nlargoLista=1000 #define el largo de las listas a ordenar\nveces=100 \t\t#define las veces que se va a hacer el ordenamiento \nacumulaMerge=0 \t#variable para acumular el tiempo de ejecucion del mergesort\nacumulaHeap=0 \t#variable para acumular el tiempo de ejecucion del heapsort\nacumulaQuick=0 \t#variable para acumular el tiempo de ejecucion del quicksort\nacumulaShell=0 \t#variable para acumular el tiempo de ejecucion del shellsort", "detail": "sorting", "documentation": {} }, { "label": "\t\tgap", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\t\tgap = gap // 2 # decreases the gap to continue the loop \n\treturn lista\nmaxValor=1000 \t#define el valor maximo de los elementos de la lista\nlargoLista=1000 #define el largo de las listas a ordenar\nveces=100 \t\t#define las veces que se va a hacer el ordenamiento \nacumulaMerge=0 \t#variable para acumular el tiempo de ejecucion del mergesort\nacumulaHeap=0 \t#variable para acumular el tiempo de ejecucion del heapsort\nacumulaQuick=0 \t#variable para acumular el tiempo de ejecucion del quicksort\nacumulaShell=0 \t#variable para acumular el tiempo de ejecucion del shellsort\nfor i in range(veces):", "detail": "sorting", "documentation": {} }, { "label": "\tmergelista", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tmergelista = [randint(0,maxValor) for r in range(largoLista)] #creamos una lista con valores al azar\n\theaplista=list(mergelista)\n\tquicklista=list(mergelista)\n\tsearchlista=list(mergelista)\n\tt1 = time.process_time()\t\t\t\t\t#tomamos el tiempo inicial\n\tmergeSort(mergelista,0,len(mergelista)-1) \t#ejecutamos el algoritmo mergeSort\n\tacumulaMerge+=time.process_time() - t1\t\t#acumulamos el tiempo de ejecucion\n\t# print(mergelista)\t\t\t\t\t\t\t#desplegamos la lista\n\tt1 = time.process_time()\t\t\t\t#tomamos el tiempo inicial\n\theapSort(heaplista)\t\t\t\t\t #ejecutamos el algoritmo heapSort", "detail": "sorting", "documentation": {} }, { "label": "\tt1", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tt1 = time.process_time()\t\t\t\t\t#tomamos el tiempo inicial\n\tmergeSort(mergelista,0,len(mergelista)-1) \t#ejecutamos el algoritmo mergeSort\n\tacumulaMerge+=time.process_time() - t1\t\t#acumulamos el tiempo de ejecucion\n\t# print(mergelista)\t\t\t\t\t\t\t#desplegamos la lista\n\tt1 = time.process_time()\t\t\t\t#tomamos el tiempo inicial\n\theapSort(heaplista)\t\t\t\t\t #ejecutamos el algoritmo heapSort\n\tacumulaHeap+=time.process_time() - t1 \t#acumulamos el tiempo de ejecucion\n\t# print(heaplista)\t\t\t\t\t\t#desplegamos la lista\n\tt1 = time.process_time()\t\t\t\t#tomamos el tiempo inicial\n\tquickresult = quickSort(quicklista)\t\t\t\t\t#ejecutamos el algoritmo quickSort", "detail": "sorting", "documentation": {} }, { "label": "\tt1", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tt1 = time.process_time()\t\t\t\t#tomamos el tiempo inicial\n\theapSort(heaplista)\t\t\t\t\t #ejecutamos el algoritmo heapSort\n\tacumulaHeap+=time.process_time() - t1 \t#acumulamos el tiempo de ejecucion\n\t# print(heaplista)\t\t\t\t\t\t#desplegamos la lista\n\tt1 = time.process_time()\t\t\t\t#tomamos el tiempo inicial\n\tquickresult = quickSort(quicklista)\t\t\t\t\t#ejecutamos el algoritmo quickSort\n\tacumulaQuick+=time.process_time() - t1\t#acumulamos el tiempo de ejecucion\n\t# print(quicklista)\t\t\t\t\t\t#desplegamos la lista\n\tt1 = time.process_time()\t\t\t\t#tomamos el tiempo inicial\n\tshellSort(searchlista)\t\t\t\t\t#ejecutamos el algoritmo shellSort", "detail": "sorting", "documentation": {} }, { "label": "\tt1", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tt1 = time.process_time()\t\t\t\t#tomamos el tiempo inicial\n\tquickresult = quickSort(quicklista)\t\t\t\t\t#ejecutamos el algoritmo quickSort\n\tacumulaQuick+=time.process_time() - t1\t#acumulamos el tiempo de ejecucion\n\t# print(quicklista)\t\t\t\t\t\t#desplegamos la lista\n\tt1 = time.process_time()\t\t\t\t#tomamos el tiempo inicial\n\tshellSort(searchlista)\t\t\t\t\t#ejecutamos el algoritmo shellSort\n\tacumulaShell+=time.process_time() - t1\t#acumulamos el tiempo de ejecucion\n\t# print(searchlista)\t\t\t\t\t\t#desplegamos la lista\n# imprimos los resultados\nprint (\"Promedio de tiempo de ejecucion de \"+ str(veces) +\" listas de largo \" + str(largoLista))", "detail": "sorting", "documentation": {} }, { "label": "\tquickresult", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tquickresult = quickSort(quicklista)\t\t\t\t\t#ejecutamos el algoritmo quickSort\n\tacumulaQuick+=time.process_time() - t1\t#acumulamos el tiempo de ejecucion\n\t# print(quicklista)\t\t\t\t\t\t#desplegamos la lista\n\tt1 = time.process_time()\t\t\t\t#tomamos el tiempo inicial\n\tshellSort(searchlista)\t\t\t\t\t#ejecutamos el algoritmo shellSort\n\tacumulaShell+=time.process_time() - t1\t#acumulamos el tiempo de ejecucion\n\t# print(searchlista)\t\t\t\t\t\t#desplegamos la lista\n# imprimos los resultados\nprint (\"Promedio de tiempo de ejecucion de \"+ str(veces) +\" listas de largo \" + str(largoLista))\nprint (\"MergeSort \" + str(acumulaMerge/veces) + \" segundos\")", "detail": "sorting", "documentation": {} }, { "label": "\tt1", "kind": 5, "importPath": "sorting", "description": "sorting", "peekOfCode": "\tt1 = time.process_time()\t\t\t\t#tomamos el tiempo inicial\n\tshellSort(searchlista)\t\t\t\t\t#ejecutamos el algoritmo shellSort\n\tacumulaShell+=time.process_time() - t1\t#acumulamos el tiempo de ejecucion\n\t# print(searchlista)\t\t\t\t\t\t#desplegamos la lista\n# imprimos los resultados\nprint (\"Promedio de tiempo de ejecucion de \"+ str(veces) +\" listas de largo \" + str(largoLista))\nprint (\"MergeSort \" + str(acumulaMerge/veces) + \" segundos\")\nprint (\"HeapSort \" + str(acumulaHeap/veces) + \" segundos\")\nprint (\"QuickSort \" + str(acumulaQuick/veces) + \" segundos\")\nprint (\"ShellSort \" + str(acumulaShell/veces) + \" segundos\")", "detail": "sorting", "documentation": {} } ]