Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote