Programming > CODING SOLUTION > CP 164 Data Structures _ test_Sorts_array.py. [Tests various array-based sorting functions.] (All)
CP 164 Data Structures _ test_Sorts_array.py. [Tests various array-based sorting functions.] [Tests various array-based sorting functions.] ----------------------------------------------------------- ... ------------- Author: Jashanpreet Pannu ID: 190898790 Email: [email protected] __updated__ = "2020-12-01" ------------------------------------------------------------------------ """ # Imports import random from Number import Number from Sorts_array import Sorts # Constants SIZE = 100 # Size of array to sort. XRANGE = 1000 # Range of values in random arrays to sort. TESTS = 100 # Number of random arrays to generate. SORTS = ( ('Bubble Sort', Sorts.bubble_sort), ('Insertion Sort', Sorts.insertion_sort), ('Merge Sort', Sorts.merge_sort), ('Quick Sort', Sorts.quick_sort), ('Selection Sort', Sorts.selection_sort), ('Bin. Ins. Sort', Sorts.binary_insert_sort), ('BST Sort', Sorts.bst_sort), ('Cocktail Sort', Sorts.cocktail_sort), ('Comb Sort', Sorts.comb_sort), ('Heap Sort', Sorts.heap_sort), ('Shell Sort', Sorts.shell_sort) ) def create_sorted(): """ ------------------------------------------------------- Creates a sorted list of SIZE Number objects with values from 0 up to SIZE-1. Use: values = create_sorted() ------------------------------------------------------- Returns: values - a sorted list of SIZE Number objects (list of Number) ------------------------------------------------------- """ values = [] i = 0 while i < SIZE: values.append(Number(i)) i += 1 return values def create_reversed(): """ ------------------------------------------------------- Create a reversed list of SIZE Number objects with values from SIZE-1 down to 0. Use: values = create_reversed() ------------------------------------------------------- Returns: [Show More]
Last updated: 2 years ago
Preview 1 out of 3 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Apr 11, 2023
Number of pages
3
Written in
All
This document has been written for:
Uploaded
Apr 11, 2023
Downloads
0
Views
122
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·