When.com Web Search

Search results

  1. Results From The WOW.Com Content Network
  2. Sorting algorithm - Wikipedia

    en.wikipedia.org/wiki/Sorting_algorithm

    Shuffling can also be implemented by a sorting algorithm, namely by a random sort: assigning a random number to each element of the list and then sorting based on the random numbers. This is generally not done in practice, however, and there is a well-known simple and efficient algorithm for shuffling: the Fisher–Yates shuffle .

  3. Quicksort - Wikipedia

    en.wikipedia.org/wiki/Quicksort

    Recursively sort the "equal to" partition by the next character (key). Given we sort using bytes or words of length W bits, the best case is O(KN) and the worst case O(2 K N) or at least O(N 2) as for standard quicksort, given for unique keys N<2 K, and K is a hidden constant in all standard comparison sort algorithms including

  4. Timsort - Wikipedia

    en.wikipedia.org/wiki/Timsort

    Timsort is a hybrid, stable sorting algorithm, derived from merge sort and insertion sort, designed to perform well on many kinds of real-world data. It was implemented by Tim Peters in 2002 for use in the Python programming language. The algorithm finds subsequences of the data that are already ordered (runs) and uses them to sort the ...

  5. Selection sort - Wikipedia

    en.wikipedia.org/wiki/Selection_sort

    Selection sort. In computer science, selection sort is an in-place comparison sorting algorithm. It has an O (n2) time complexity, which makes it inefficient on large lists, and generally performs worse than the similar insertion sort. Selection sort is noted for its simplicity and has performance advantages over more complicated algorithms in ...

  6. Comparison sort - Wikipedia

    en.wikipedia.org/wiki/Comparison_sort

    A comparison sort is a type of sorting algorithm that only reads the list elements through a single abstract comparison operation (often a "less than or equal to" operator or a three-way comparison) that determines which of two elements should occur first in the final sorted list. The only requirement is that the operator forms a total preorder ...

  7. Bubble sort - Wikipedia

    en.wikipedia.org/wiki/Bubble_sort

    Bubble sort. The list was plotted in a Cartesian coordinate system, with each point (x, y) indicating that the value y is stored at index x. Then the list would be sorted by bubble sort according to every pixel's value. Note that the largest end gets sorted first, with smaller elements taking longer to move to their correct positions.

  8. Merge sort - Wikipedia

    en.wikipedia.org/wiki/Merge_sort

    In computer science, merge sort (also commonly spelled as mergesort and as merge-sort[2]) is an efficient, general-purpose, and comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the relative order of equal elements is the same in the input and output.

  9. Cycle sort - Wikipedia

    en.wikipedia.org/wiki/Cycle_sort

    The following Python implementation [1] [circular reference] performs cycle sort on an array, counting the number of writes to that array that were needed to sort it. Python def cycle_sort ( array ) -> int : """Sort an array in place and return the number of writes.""" writes = 0 # Loop through the array to find cycles to rotate.