7. Which algorithm would be faster to solve a problem with n=100 (1) A linear al
ID: 3651334 • Letter: 7
Question
7. Which algorithm would be faster to solve a problem with n=100(1) A linear algorithm which needs exactly 10^9n operations
(2) A quadratic algorithm which needs exactly 10^6*n^2 operations
8. You have a computer that performs 1 primary operation in 1.5 ?s (1 microsecond = 1 ?s = 10^(-6)
second). What is the largest n (problem size) that you can solve in 1 minute, if your program
performs a total of 1000n^2+1000 operations?
9. What is the best case scenario order of a linear search of an array of size n?
10. What is the worst case scenario of this algorithm?
Algorithm arrayMax(A, n)
currentMax <-A[0]
for I <1 to n-1 do
if A[i]> currentMax then
currentMax<-A[i]
return currentMax
Explanation / Answer
(1) A linear algorithm which needs exactly 10^9n operations
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.