def quick_sort(collection):
          length = len(collection)
          if length <= 1:
              return collection
          else:
              pivot = collection.pop()
              greater, lesser = [], []
              for element in collection:
                  if element > pivot:
                      greater.append(element)
                  else:
                      lesser.append(element)
              return quick_sort(lesser) + [pivot] + quick_sort(greater)
      
      Python language logo

      Quick Sort

      Python
      QuickSort
      HGV Public Cookbook

      Function to perform Quick sort.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.