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 8474175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:33:24+00:00 2026-06-10T17:33:24+00:00

So I need a mathematical expression for the following loop, but I can’t seem

  • 0

So I need a mathematical expression for the following loop, but I can’t seem to grasp it. I am assuming I am just missing something simple.

while a <= b
    a = a + a
end

Using an analysis, what would be the run time of this function?

  • 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-06-10T17:33:26+00:00Added an answer on June 10, 2026 at 5:33 pm

    The run time is dependent on the logarithm of b. In other words, the time complexity is O(log N).

    You can see this if you start a at 1 and b at 256. Each time through the loop, a is doubled so that there are only nine iterations (would be eight if the condition was < b).

    Each doubling of the b value will result in one extra iteration.

    Of course, this is complexity analysis, the runtime depends on a host of other factors such as (almost certainly not an exhaustive list):

    • how fast your machine is.
    • what other things it has to do concurrently.
    • initial value of a: a == 0 gives infinite run time, a == b + 1 gives you constant run time.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to select all products whose fields conform to a simple mathematical expression
I know this question is difficult to understand but I need a mathematical equation
Integers can be used to store individual numbers, but not mathematical expressions. For example,
I want to check whether a simple mathematical expression would overflow (using checked and
I need a mathematical function/formula/expression to take a number as parameter and find the
I'm currently working on a small project with OCaml; a simple mathematical expression simplifier.
I'm looking for something that can interpret a string in php and perform simple
I need to display mathematical function formulas. For this, how can i echo those
I need an array of 820 zeros for using with a mathematical function. In
Need just a push in the right direction with this. I'm building a multi-language

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.