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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:59:12+00:00 2026-05-25T10:59:12+00:00

This is regarding amortized analysis of binary counter. All the entries in the Array

  • 0

This is regarding amortized analysis of binary counter. All the entries in the Array start at 0 and at each step we will be simply incrementing the counter.

Here author is mentioning as below.

We are using a potential function that is equal to the number of 1-bits in the current count.

Question 1: What does above statement mean?

And other question i have is in the analysis it is mentioned as

n+(n/2)+(n/4)+— is atmost 2n. how we got result as atmost 2n?

Thanks!

  • 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-25T10:59:13+00:00Added an answer on May 25, 2026 at 10:59 am

    The costs for incrementing in this example are the number of bit-flips to execute.

    I.e. incrementing 3 (0b11) to 4 (0b100) has cost of 3 (all three positions flipped).

    Now with that you couldn’t say, that the algorithm is amortized constant, because the amount of time depends on the number of bit-flips and thus varies on the number.

    To work around that one use the potential method on a sequence of increment operations starting with 0. The potential is now the number of bits that are 1.

    • φ(0) = 0
    • φ(1) = 1
    • φ(2) = 1
    • φ(3) = 2
    • φ(4) = 1 etc

    This makes sense, since for each bit that is 1, an increment operation in the future will have to change it to 0 at some point. So whenever in increment occurs that needs to flip more than the last bit, it makes use of the potential of the value.

    Now continuing the amortized analysis, you will find, that the potential always increases by 1 and in each increment operation you decrease the potential for every 1 bit you flipped. Combining this in each operation you have costs of 2: a) flipping a 0 to a 1, b) saving 1 for the potential. Flipping all the ones before the 0 is paid using the potential.

    See also: http://en.wikipedia.org/wiki/Potential_method

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

Sidebar

Related Questions

This is regarding amortized analysis. Following is text from an article. Amortized analyis for
The View controller programming guide states this regarding view controller's usage: Each custom view
This is regarding forwarding POST variables properly in ASP.Net To force all connections use
I found this regarding how the C preprocessor should handle string literal concatenation (phase
This is regarding SQL server 2008 management studio.. I connect to different environment DB
Regarding this post and this other one . Suppose I have the following: public
Regarding this post about email verification, using C#, how would you issue a VRFY
I read this article regarding creating popup notes with javascript and css The problem
I was searching on web regarding this but could not find any relevant answer.
i have a question regarding this Haskell code: module Queue (Queue, emptyQueue, queueEmpty, enqueue,

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.