About 50 results
Open links in new tab
  1. algorithm - Complexity of a random sorting - Stack Overflow

    Mar 2, 2015 · Okay this might be the worst way way to sort an array arr of n distinct integers but I want to analyse this algorithm: Check if arr is sorted. If so, return. Randomly permute the elements of arr.

  2. Are there any worse sorting algorithms than Bogosort ... - Stack Overflow

    Apr 10, 2010 · From David Morgan-Mar 's Esoteric Algorithms page: Intelligent Design Sort Introduction Intelligent design sort is a sorting algorithm based on the theory of intelligent design. Algorithm …

  3. sorting - Algorithm to maintain a sorted (numerically) list of numbers ...

    Nov 28, 2022 · Say I am generating random numbers using Math.random(), maybe 1000 of them, and I want to have them in ascending order (at all times). Is there an algorithm of some variety that can …

  4. algorithm - Running Time of Random Sort - Stack Overflow

    Feb 4, 2011 · 3 How would you describe the running time of this sort, given a function sorted which returns True if the list is sorted that runs in O (n): def sort(l): while not sorted(l): random.shuffle(l) …

  5. algorithm - Random topological sorting with uniform distribution in ...

    Jul 24, 2016 · 3 I want an algorithm for topological sorting that doesn't provide the same sorting each time, but a random one, each sorting being equally likely to all others. Generating all possible …

  6. Why is this simple shuffle algorithm — sorting by random() — biased?

    Nov 18, 2021 · JavaScript doesn't specify a specific algorithm for sort, and this shuffling algorithm can give very biased results depending on the specific sorting algorithm in use. Below, I describe some …

  7. What's the fastest algorithm for sorting a linked list?

    1 As I know, the best sorting algorithm is O (n*log n), whatever the container - it's been proved that sorting in the broad sense of the word (mergesort/quicksort etc style) can't go lower. Using a linked …

  8. algorithm - Why is quicksort better than mergesort? - Stack Overflow

    Sep 16, 2008 · This can be mitigated by random shuffle before sorting is started. QuickSort doesn't takes extra memory that is taken by merge sort. If the dataset is large and there are identical items, …

  9. sorting - Which sort algorithm works best on mostly sorted data ...

    Oct 10, 2015 · Nevertheless, with an appropriate algorithm for choice of pivot (either random or median-of-three - see Choosing a Pivot for Quicksort), Quicksort will still work sanely. In general, the difficulty …

  10. sorting - What's the most efficient way to construct a new, sorted ...

    Sep 20, 2020 · Most questions around sorting talk about sorting an existing unsorted array. Is constructing a new array in a sorted order an equivalent problem or a different one? It boils down to …