Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Recall the definition of logarithm base two: saying p = log m is the same as saying m = 2P. In this class, we

Recall the definition of logarithm base two: saying p = log m is the same as saying m = 2P. In this class, we

Recall the definition of logarithm base two: saying p = log m is the same as saying m = 2P. In this class, we will typically write lg to mean log2. (1) How many bits are needed to write down a positive integer n? Give your answer in big-O notation, as a function of n. (2) How many times does the following piece of code print ?hello?? Assume n is an integer, and that division rounds down to the nearest integer. Give your answer in big-O form, as a function of n. while n > 1: print "hello" n := n/2

Step by Step Solution

3.48 Rating (164 Votes )

There are 3 Steps involved in it

Step: 1

Below is the Python code for the two scenarios you described 1 Number of bits nee... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understandable Statistics Concepts And Methods

Authors: Charles Henry Brase, Corrinne Pellillo Brase

12th Edition

1337119911, 978-1337517508, 133751750X, 978-1337119917

More Books

Students also viewed these Programming questions