4337 links
  • Arnaud's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
page 1 / 1
1 results tagged recursiv x
  • 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 at 4:05:26 PM GMT+1 - permalink - archive.org - https://www.integralist.co.uk/posts/algorithmic-complexity-in-python/
    algo recursiv sort
Links per page: 20 50 100
page 1 / 1
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation