pyufunc.algo_quick_sort#

pyufunc.algo_quick_sort(array, verbose=False)#

Sort the input array using quick sort algorithm.

Parameters:
  • array (Iterable) – iterable object to be sorted.

  • verbose (bool, optional) – Whether to print out running time. Defaults to False.

Raises:

ValueError – Input should be iterable.

Returns:

sorted array

Return type:

Iterable

Example

>>> from pyufunc import quick_sort
>>> quick_sort([3, 6, 8, 10, 1, 2, 1])
[1, 1, 2, 3, 6, 8, 10]
>>> quick_sort([3, 6, 8, 10, 1, 2, 1], verbose=True)
Running time of quick_sort: O(n log n)
[1, 1, 2, 3, 6, 8, 10]