Question: Discrete Math: Consider your algorithm from the previous exercise. Here it is: Construct an algorithm that takes as input a bit string and finds the
Discrete Math: Consider your algorithm from the previous exercise.
Here it is:
Construct an algorithm that takes as input a bit string and finds the location of the last 1 in this string
or returns 0 if there are no 1s in the string.
a) What is the maximum number of comparisons which must be made in this algorithm?
b) What is the maximum number of times in which you must assign a value to the variable representing the location of the last 1 in this algorithm?
c) Determine the sum of your answers from parts (a) and (b).Find a big O-estimate for this value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
