Module dsa.sorttools
Module to access functions for sort benchmarking.
Functions
def filled_array(n: int) ‑> list
-
Return an array filled with integers from 0 to n-1.
Args
n
:int
- the number of integers to generate.
Returns
Array filled with integers from 0 to n-1.
def is_sorted(array) ‑> bool
-
Return a boolean on whether an array is sorted in ascending order or not.
Args
array
- the array to verify.
Returns
True if the array is sorted, False otherwise.
def rand_int_array(n: int, maxnum: int) ‑> list
-
Return an array of n integers of random numbers from 0 to maxnum.
Args
n
:int
- The number of integers to generate.
maxnum
:int
- The maximum number in a range (0-maxnum inclusive).
Returns
Array of n integers of random numbers from 0 to maxnum.
def shuffle_array(n: int) ‑> list
-
Return a shuffled array filled with integers from 0 to n-1.
Args
n
:int
- The number of integers to generate.
Returns
Array shuffled with integers from 0 to n-1.