Ordenamiento
Observa cómo se ejecutan los algoritmos de ordenamiento paso a paso: compara, intercambia y coloca los elementos hasta ordenar el arreglo.
Insertion SortWatch insertion sort build a sorted section one element at a time.Selection SortSee selection sort repeatedly pick the smallest element and place it.Merge SortWatch merge sort divide the array and merge the pieces back in order.Bubble SortSee adjacent elements compared and swapped until the array is sorted.Quick SortWatch quick sort partition around a pivot and recurse on each side.Heap SortSee heap sort build a max-heap and extract the largest element each time.Radix SortWatch radix sort order numbers digit by digit, from least significant.Counting SortSee counting sort tally values and rebuild the array in sorted order.
Comparación de Ordenamiento
| Algoritmo | Mejor | Promedio | Peor | Espacio | Estable |
|---|---|---|---|---|---|
| Insertion Sort | O(n) | O(n²) | O(n²) | O(1) | Yes |
| Selection Sort | O(n²) | O(n²) | O(n²) | O(1) | No |
| Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) | Yes |
| Bubble Sort | O(n) | O(n²) | O(n²) | O(1) | Yes |
| Quick Sort | O(n log n) | O(n log n) | O(n²) | O(log n) | No |
| Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) | No |
| Radix Sort | O(nk) | O(nk) | O(nk) | O(n + k) | Yes |
| Counting Sort | O(n + k) | O(n + k) | O(n + k) | O(n + k) | Yes |