Hi,
What is the time complixity of the following code:

Can you please give rules to follow , I couldn't figure it out!

func(n)
    s←0;
    for i←n to n^3
    do
    j←1;
    while j < i^2
    do
    j←j×2;
    s←s+j−i;
    return(s);

Thanks

Recommended Answers

All 3 Replies

Could not find complixity in the dictionary.

@saifN - your post makes little sense to me. You are declaring a function that takes an argument 'n', and only has a statement 's' in the body. No operations. No nothing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.