Using python code below, modify it by providing relevant information. Run this python code to…

Using python code below, modify it by providing relevant information. Run this python code to produce a plot of the running times of the selection sort and bubble sort algorithms; it will be displayed and saved to file. Verify that the running times are in fact quadratic – with potentially different constants/lower order terms. If they are not, fix the mistake somewhere in the code.

Python Code :

import matplotlib.pyplot as plt

if __name__ == ‘__main__’:

filepath = ” # TODO: add path to your data file here

names = [] # TODO: add the names of each sorting method in the order they are saved in the text file

x = list(range(1000, 20001, 1000)) # this is the range of input sizes tested

with open(filepath, ‘r’) as file:

for i, line in enumerate(file):

y = list(map(int, line.split(‘,’)))

plt.plot(x, y, label=names[i])

plt.xlabel(‘Input size’)

plt.ylabel(‘Time taken (ns)’)

plt.title(‘Comparison of sort procedures’)

plt.legend()

plt.savefig(‘sorting.pdf’)

plt.show()

RUNNING TIMES :

———Selection Sort———

n Time(nanoseconds)

1000 5420677

2000 18542531

3000 36949001

4000 62168492

5000 78441324

6000 106607691

7000 143365228

8000 187854569

9000 238544863

10000 294727565

11000 360458511

12000 424965149

13000 498089653

14000 577262773

15000 667871979

16000 755799839

17000 855884386

18000 951070680

19000 1065027887

20000 1177695067

———Bubble Sort———

n Time(nanoseconds)

1000 7217497

2000 29115586

3000 67260576

4000 119510226

5000 185503409

6000 271108129

7000 369786024

8000 484773888

9000 613341459

10000 761379954

11000 922272367

12000 1101249511

13000 1295480426

14000 1500955572

15000 1722094433

16000 1970645085

17000 2217324729

18000 2478695892

19000 2778185237

20000 3082218784

Place your order
(550 words)

Approximate price: $22

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:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
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.

Read more

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.

Read more

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.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!