4259 links
  • Arnaud's links
  • Home
  • RSS Feed
  • Tag cloud
  • Login
search: tag:sort — newest first
  • Quick sort algo

    from random import randrange

    input = [10, 5, 2, 3, 7, 0, 9, 12]

    def quicksort(arr):
    if len(arr) < 2:
    return arr
    else:
    rand = randrange(0, len(arr)) # grab a random index
    pivot = arr.pop(rand)
    less = [i for i in arr if i <= pivot]
    greater = [i for i in arr if i > pivot]
    return quicksort(less) + [pivot] + quicksort(greater)

    print("sorted: ", quicksort(input))

    February 6, 2022 - permalink - https://www.integralist.co.uk/posts/algorithmic-complexity-in-python/
    algo nomarkdown recursiv sort
  • Note: python natural sort

    def atoi(text):
    return int(text) if text.isdigit() else text

    def natural_keys(text):
    return [ atoi(c) for c in re.split(r'(\d+)', text) ]

    my_list.sort(key=natural_keys)

    October 9, 2020 - permalink - https://links.infomee.fr/shaare/6OC8rw
    python sort
  • GitHub - lostutils/uq
    February 9, 2020 - permalink - https://github.com/lostutils/uq
    sort uniq
  • Note: jq sort example

    |jq -r '.ApplicationVersions|sort_by(.DateCreated)|.[]|.VersionLabel'|tail -1

    April 12, 2017 - permalink - https://links.infomee.fr/shaare/9B1NEQ
    jq sort
  • Javascript only - sort a bunch of DIVs - Stack Overflow
    December 23, 2016 - permalink - http://stackoverflow.com/questions/5066925/javascript-only-sort-a-bunch-of-divs
    div js sort
  • Sort lines | Vim Tips Wiki | Fandom powered by Wikia

    vim <3

    :sort u

    November 21, 2016 - permalink - http://vim.wikia.com/wiki/Sort_lines
    sort vim