# Do your measurements provide evidence about the time complexity of these operations?

MIST.3050
Homework 9
In this assignment, you will write a program to test the performance of three operations
1. dictionary lookup using key (d[key])
2. list lookup, i.e. finding the index of the first occurrence of a value (lst.index(v))
3. list sort (sorted(lst))
What is the time complexity of each operation? Assuming Python adopts the most efficient
implementation.
[ Hint: Choose from O(1), O(n), O(n log(n) ), O(n^2) ]
Now, write a program to test the performance of each operation using five problem sizes:
1K, 10K, 100K, 1M, 10M
Use random.sample() to generate unique values in random order. For example.
L=random.sample(range(10), 10)
will assign L a list of size 10 with values 0 to 9, ordered randomly.
For the test dictionaries, you may make each entry’s value the same as the key using a technique
shown in the following example:
d= dict(zip(L,L))
In the example, the dictionary d will have keys and values taken from the two lists passed to the
zip function.
An example output the program is shown in Figure 1. For dictionary lookup: simply test the time
taken for finding d[42] (i.e., retrieving the value for key=42); for list lookup, test the time taken
for finding the index of the first occurrence of 42.
Figure 1. Example output of the program. The ratios are time taken between problem size 10x
and size x; the list sort over list lookup is time ratio between sort and lookup of the same list size.
Note: you may get a divide by 0 error when computing ratios if there are 0’s in measured time.
In your report, make sure that you analyze the results and relate them to your answer to the
question posted earlier. Do your measurements provide evidence about the time complexity of
these operations?

## Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

# Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

### Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

### Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

### Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.