the desired algorithm and time the sort. But the problem was how do I create multiple lists in one go? I wrote up some code that creates a random list based on some user info given.
def whichFunction(): loop = 1 choice = 0 while loop == 1: print "Welcome to the cool sorting function!" user_choice = input("Which sorting function would you like to use? Type 1-3.\n 1. BubbleSort\n 2. QuickSort\n 3. Isort\n ") sortingType = input("Which type of data pattern would you like? Type 1-3\n 1.Random\n 2.sorted\n 3.reverse sorted\n") n = input("What is the minimum array size?") x = input("what is the size of array increments?") y = input("What is the number of test arrays?") # a = [ for i in range(y)] a = [random.randint(0,x) for r in xrange(n)] print a
[1, 0, 2, 0, 2, 2, 2, 2, 2, 1]
for n = 10, x=2, y=2
Now the MAIN question is, how do i create "y" number of lists that can be implemented into my while loop, that will be sorted into my bubble sort, quick sort, or insertion sort based on my user preference. Thanks, I can post my sorting functions if needed, though they are pretty standard.