Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1) What is the complexity of the following algorithms to compute the sum of all integer number from 1 to N? def sum1(N): sum =
1) What is the complexity of the following algorithms to compute the sum of all integer number from 1 to N? def sum1(N): sum = 0 for n in range(1, N+1): sum += n print(sum) def sum2(N): sum = N*(N+1)/2 A. O(N**2) and O(N) B. O(log(N)) and O(N) C. O(N) and O(1) D. O(N) and O(N) E. O(log(N)) and O(1) You need to justify your choice! 2) Consider the statement: 2.9*N = 0(3.5*N**(3/2)). Is it: A. True. B. False. C. Sometimes true, and sometimes false. D. Both true and false. E. None of the above. Please justify your
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