Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7638415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:10:18+00:00 2026-05-31T08:10:18+00:00

Stuck with me HW – Need to try complexity time=0; for (i=n; i>=1; i

  • 0

Stuck with me HW – Need to try complexity

time=0;
for (i=n; i>=1; i = sqrt(i))
 for (j=1; j<=i; j++)
 time++;

What I did – First loop going like this:
i=n, n^(1/2), n^(1/4)…1
than we get:

n^(1/2)^k = 1
if I log both sides one side get 0… what should I do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:10:20+00:00Added an answer on May 31, 2026 at 8:10 am

    I suppose there is a typo somewhere because otherwise it’s Θ(∞) if the input n is not smaller than 1. (For i == 1, the update i = sqrt(i) doesn’t change i, so that’s an infinite loop.)

    So let us suppose it’s actually

    time = 0;
    for (i = n; i > 1; i = sqrt(i))
        for (j = 1; j <= i; j++)
            time++;
    

    Then, to get the complexity of nested loops, you need to sum the complexity of the inner loop for each iteration of the outer loop. Here, the inner loop runs i times, obviously, so we need to sum the values i runs through in the outer loop. These values are n, n^0.5, n^0.25, ..., n^(1/2^k), where k is characterised by

    n^(1/2^(k+1)) < 2 <= n^(1/2^k)
    

    or, equivalently,

    2^(2^k) <= n < 2^(2^(k+1))
    2^k <= lg n < 2^(k+1)
    k <= lg (lg n) < k+1
    k = floor(lg(lg n))
    

    Now it remains to estimate the sum from above and below to get the Θ of the algorithm. This estimate is very easy if you start writing down the sums for a few (large) values of n.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am stuck in a sql problem. I need something like this M S C
I'm a bit stuck on this. Basically I want to do something like the
I am bit stuck with this one.. what i want is update app_name (first
Stuck using a table layout like this below with a lot of content in
Stuck with this particular issue. I have code that get lots of pages from
stuck at this, seeking advice. What i did and my Project: i make a
Im stuck on this httpWebRequest problem. I need to send XML to a website.
Im stuck I got this flash that need's to be configured in a certain
I'm stuck on a PHP 4 server, and I would like to start moving
I'm kinda stuck with this one so I hoped someone could help me. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.