Question: 2 . You will write two different programs ( worth 1 0 points each ) , each one will demonstrate one algorithm. They will use
You will write two different programs worth points each each one will demonstrate one algorithm. They will use the function below to fill the list of values:
import random
entries
def filllistn:
lst randomrandintn for z in range n
return lst
k filllistentries
printk
Part A point each Estimate the Big Oh order for the following algorithms write your answer below each:
# linear search when entries are out of orderAnswer:
# linear search when entries are in ascending order Answer:
# bubble sort when entries are out of order Answer:
# bubble sort when entries are in ascending order Answer:
# bubble sort when entries are in descending order Answer:
Part B Write two programs, one for
Bubble sort and one for
Linear search
that will do the following:
fill a list using the filllist random generation function provided above
determine the time it takes to run the algorithm with numbers in out of order
determine the time it takes to run the algorithm with numbers in ascending order
print results comparing the two runs with different orders
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
