1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gennadij [26K]
3 years ago
5

What is the total running time of counting from 1 to n in binary if the time needed to add 1 to the current number i is proporti

onal to the number of bits in the binary expansion of i that must change in going from i to i + 1?
Computers and Technology
1 answer:
KatRina [158]3 years ago
3 0

The running time would be about 67minutes  

You might be interested in
Develop a CPP program to test is an array conforms heap ordered binary tree. This program read data from cin (console) and gives
mafiozo [28]

Answer:

Following are the code to this question:

#include<iostream>//import header file

using namespace std;

int main()//defining main method

{

int ar[7];//defining 1_D array that stores value      

int i,x=0,l1=1,j; //defining integer variable

for(i=0;i<7;i++)//defining for loop for input value from user ends  

{

cout<<"Enter a Number: ";//print message

cin>>ar[i];//input value in array

if(l1<=2 && i>0)//using if block that checks the array values  

{

x++;//increment the value of x by 1  

}

if(l1>2 && i>0)//using if block that checks the array values  

{

l1=l1-2;//using l1 variable that decrases the l1 value by 2  

}

j=i-x;//using j variable that holds the index of the root of the subtree

if(i>0 && ar[j]>ar[i])// use if block that checks heap condition  

{

l1++; //increment the value of l1 variable

}

if(i>0 && ar[j]<ar[i])// using the if block that violate the heap rule  

{

cout<<ar[i]<<" "<<"Violate the heap";//print message with value

break;//using break keyword  

}

}

return 0;

}

Output:

1)

Enter a Number: -15

Enter a Number: -5

-5 Violate the heap

2)

Enter a Number: 45

Enter a Number: 0

Enter a Number: 55

55 Violate the heap

Explanation:

  • In the above-given C++ language code, an array "ar" and other integer variables " i,x,l1, j" is declared, in which "i" variable used in the loop for input values from the user end.
  • In this loop two, if block is defined, that checks the array values and in the first, if the block it will increment the value of x, and in the second if the block, it will decrease the l1 value by 2.
  • In the next step, j variable is used that is the index of the root of the subtree. In the next step, another if block is used, that checks heap condition, that increment the value of l1 variable. In the, if block it violate the heap rule and print its values.
5 0
3 years ago
Below, we’ve provided a for loop that sums all the elements of list1. Write code that accomplishes the same task, but instead us
Tanzania [10]

Answer:

Explanation:

The code that would best accomplish this task using a while loop would be the following:

list1 = [8, 3, 4, 5, 6, 7, 9]

accum = 0

n = 0

while n < 7:

        accum += list1[n]

        n += 1

This code will continue throughout the list1 array and add every value to the accum variable.

5 0
3 years ago
On Windows 7 or 8 How are the windows help and support options different when you press F1 when the desktop is active as opposed
Dominik [7]
It opens a different article depending on what program you on, to accommodate that program.
6 0
3 years ago
I need help plz it keeps on happening and idk what to do
Citrus2011 [14]

Answer:

Hi I have never had this problem but maybe you can reset it if it doesn't work you should call your administrators

5 0
4 years ago
Sharon is troubleshooting a computer and wants to test the hard drive in another computer. Sharon removes the hard drive and not
spayn [35]

Answer:

The correct answer to the following question will be "Molex connector".

Explanation:

  • Molex connector seems to be the dialect term for the connectivity of a two-piece plug and socket. The two-piece concept was pioneered by the company named Molex Connector and has become an established electronic design.
  • Inside a PC case, it brings DC control to the devices. The wide one of those on the right is being used for discs, DVD and CD-ROM drives, whereas the narrow one is being used for floppy along with other items.

Therefore, Sharon has to use the Molex connector to test any type of drive in their device.

4 0
3 years ago
Other questions:
  • A musical compact disc is an example of
    13·1 answer
  • If we have a priority queue storing approximately million numbers, and the bottom level is "full", which of the following statem
    9·1 answer
  • How might your use of computers and knowledge of technology systems affect your personal and professional success?
    14·1 answer
  • Select the term below which is a protocol that provides a method for software components to communicate, interact, and share dat
    6·1 answer
  • Most sus color in Among Us? Red is safe I saw him scan. I'll give brainliest because why not. I'm bored.
    14·2 answers
  • ________ is used by text recognition software to convert typed, printed, or handwritten text into the computer-based characters
    15·1 answer
  • Converting Denary to Binary
    15·1 answer
  • If the starting address location changes, in which of the following cases, the program has to be recompiled? Select one: a. Both
    12·1 answer
  • Select the correct answer from each drop-down menu.
    6·1 answer
  • ANSWER QUICKLY!!! <br><br> What is an advantage of digital portfolios?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!