class Sorts: # The Sorts @staticmethod def radix_string_sort(strings): """ ------------------------------------------------------- Performs a string radix sort. Use: Sorts.radix_string_sort(strings) ------------------------------------------------------- Parameters: strings - an array of strings (list of str) Returns: None ------------------------------------------------------- """ # your code here return
class Sorts:
# The Sorts
@staticmethod
def radix_string_sort(strings):
"""
-------------------------------------------------------
Performs a string radix sort.
Use: Sorts.radix_string_sort(strings)
-------------------------------------------------------
Parameters:
strings - an array of strings (list of str)
Returns:
None
-------------------------------------------------------
"""
# your code here
return
@staticmethod
def is_sorted(a):
"""
-------------------------------------------------------
Determines whether an array is sorted or not.
Use: b = Sorts.is_sorted(a)
-------------------------------------------------------
Parameters:
a - an array of comparable elements (?)
Returns:
srtd - True if contents of a are sorted,
False otherwise (boolean)
-------------------------------------------------------
"""
srtd = True
n = len(a)
i = 0
while srtd and i < n - 1:
if a[i].lower() <= a[i + 1].lower():
i += 1
else:
srtd = False
return srtd
Step by step
Solved in 2 steps