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

  • Home
  • SEARCH
  • 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 7031925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:52:02+00:00 2026-05-28T00:52:02+00:00

for (int j=0,k=0; j<n; j++) for (double m=1; m<n; m*=2) k++; I think it’s

  • 0
 for (int j=0,k=0; j<n; j++)
   for (double m=1; m<n; m*=2)
      k++;

I think it’s O(n^2) but I’m not certain. I’m working on a practice problem and I have the following choices:

  • O(n^2)
  • O(2^n)
  • O(n!)
  • O(n log(n))
  • 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-28T00:52:03+00:00Added an answer on May 28, 2026 at 12:52 am

    Its O(nlog2n). The code block runs n*log2n times.

    Suppose n=16; Then the first loop runs 16 (=n) times. And the second loops runs 4(=log2n) times (m=1,2,4,8). So the inner statement k++ runs 64 times = (n*log2n) times.

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

Sidebar

Related Questions

I have following method which is failing . I think I am comparing double
I have a school problem but I do not understand what it actually asks.
Short problem: #include <iostream> using namespace std; int main() { double **T; long int
I think instance variables are simple data types like int or double. Everything that
i have following code for heapsort #include <iostream> using namespace std; void exch(int a[],int
I'm really getting the hang of recursion (or so I think), but this problem
My code: def power(x: Double, n: Int): Double = { if (n % 2
int main() { double i=4; printf(%d,i); return 0; } Can anybody tell me why
When declaring any primitive type data like int or double they get initialized to
I'm reading some C code like that: double function( int lena,double xa,double ya, double

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.