Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (40 points] Minimum in list algorithms - benchmark and plot Write two Python functions to find the minimum number in a list. The functions

image text in transcribedimage text in transcribed image text in transcribed

1. (40 points] Minimum in list algorithms - benchmark and plot Write two Python functions to find the minimum number in a list. The functions should take a random list of integers from 1 to 1000. The lists can be of size ranging from 1,000 to 20,000 integers, in increments of 2,,000. The functions should return the minimum number in the list. The first function, f_linear(), should do one pass through the list and be linear O(n). The second function, called f_quadratic(), should compare each number to every other number on the list using nested loops giving a complexity of O(n^2). [By the way this is not a good algorithm, but we are doing it to illustrate the Big-O concept] To save you some time here is one way to write this function: deff_quadratic(x): min = x[0] I = len(x) for i in range(1): for jin range(i+1,1): if x[i]

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

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

=+ What is the role of government in bargaining?

Answered: 1 week ago

Question

=+ Who is the negotiation partner at company level?

Answered: 1 week ago

Question

=+Which associations exist?

Answered: 1 week ago