Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use your program to determine the average number of comparisons performed in sorting 1000 arrays for each of the array sizes, 10, 50, 100, 500,

Use your program to determine the average number of comparisons performed in sorting 1000 arrays for each of the array sizes, 10, 50, 100, 500, 1000, 5000, 10,000, 50,000 and 100,000. For each size, have your code print the average number of comparisons performed on the 1000 arrays of that size and also what the predicted average-case time complexity from the formula.

list_sizes = [10, 50, 100, 500, 1000, 5000, 10000, 50000, 100000]
numberOfLists = 1000 # the number of lists to sort for each list size
numbersOfComparisons = []
...
 

When your code is finished, create a table, using a spreadsheet or other technology, that has four columns:

Number of Items

Predicted Average Number of Comparisons

Observed Average Number of Comparisons

Percent Difference.

The percent difference from the predicted average would be calculated as (|predictedobserved|)/predicted.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago