Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i just send this question to an expert but the answer from two expert is totally different, one is O ( nlogn ) , one

i just send this question to an expert but the answer from two expert is totally different, one is O(nlogn), one is O(n^2 logbase2n) what is the correct answer? Can u please help me to write down the number of operation step by step? Like beside every lines, please help to explain also, because i am really weak at this lesson. Thanks!Determine the big O running time of the method myMethod(int n) by counting the approximate number of operations it performs. Show all details of your answer.
Static void doIt (int n){
int i
int j (2\times n)
loop while ( j >0)
i n
loop while ( i >=1){ i i /2}
j j 1}}
Static int myMethod (int n)
{ sum 0
for i 1 to n {
sum = sum + doIt(i)} return 1)

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

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions