Snippets tagged sorting

  • Python's sorted function

    This is an attempt to produce similar behavior as seen in the sorted( ) function in Python. Supporting only one of the three optional arguments. The key - Specifies a function of one argument that is used to extract a comparison key from each list element

    2 people like this

    Posted: 13 years ago by Cameron Frederick

  • Frequency Sort

    Sort a list by a frequency distribution. Frequency is calculated as per a a provided function. In the test case a list of lists is sorted by the frequency of the length of the lists.

    1 people like this

    Posted: 11 years ago by Muigai

  • Insertion sort

    An tail recursive implementation of insertion sort on list

    0 people like this

    Posted: 1 year ago by tathanhdinh

  • Incremental (Functional) QuickSort

    Functional quicksort inspired by the Haskell Quick Sort at Since F# lists aren't lazy, uses sequences instead of lists to be haskell like. Roughly O(n) if you Seq.take 1, full on QS if you enumerate the whole thing.

    3 people like this

    Posted: 13 years ago by Tony Lee

  • Natural Sort Order

    Sort strings as file managers usually do, treating numeric substrings as numbers.

    3 people like this

    Posted: 4 years ago by Jim Foye

  • Distance sort

    Sort collection of items based on criteria of closest distance between consecutive items. The resulting collection first element is one of two farthest items, the end element is the second of the farthest pair. For the collection of `n` items the distance function is called n*(n-1) /2 times. The distance for pair of items is assumed to not depend on items order.

    2 people like this

    Posted: 1 year ago by Konstantin Sh