Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is Data structures and algorithms, please solve bith questions 1 and 2, i want to check if my answers are right. 1. State the

this is Data structures and algorithms, please solve bith questions 1 and 2, i want to check if my answers are right.
image text in transcribed
image text in transcribed
1. State the order of growth of the following functions in big-O notation. For exauple, the function 3n is O(n). Remember you ned to write the big-O notation. (a) 10+3n+2n2+n4+5n3 (b) 5+3n3+2n2logn+5n+2n2 (c) n5+n2 2. Consider each of the following algorithms. What is the time complexity in big- O notation? Give justifications. Note: If two loops are run one after another, the overall time complexity is the sum of the complexities of the two loops. (a) // Assume n and m are given positive integers xn while x>1 do xx2 for y1 to m do output y (b) // Assume n is a given positive integer being power of 2 count xn while x>1 do begin xx/2 count count +1 end out put count (c) // Assume n is a given positive integer being power of 2 xn yn while x>1 do xx2 while y>1 do yy/2 (d) // Assume n and m are given positive integers xn while x>1 do begin xx2 for y1 to m do output y if x==n then begin for y1 to m do begin output y end end x+x2 end (f) // Assume n is a given positive integer being power of 2 x1 while xn do begin xx+3 y1 while yn do begin yy2 end end (g) // Assume n and m are given positive integers for x1 to n do begin for y1 to m do begin for z1 to n do begin output x+y+z end

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

More Books

Students also viewed these Databases questions

Question

LO4 Provide an overview of four challenges facing HR today.

Answered: 1 week ago