Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started