Answered step by step
Verified Expert Solution
Link Copied!

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 =

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

Students also viewed these Databases questions

Question

Be familiar with the five basic ways to manage demand.

Answered: 1 week ago