- Show that this algorithm determines the number of 1 bits in the bit string S:
procedurebit count(S: bit string)
count:= 0
while
count:=count+ 1
returncount{countis the number of 1s inS}
Here
- How many bitwiseANDoperations are needed to find the number of 1 bits in a stringSusing the algorithm in part (a)?
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Discrete Mathematics and Its Applications ( 8th International Edition ) ISBN:9781260091991
- Write out the addition and multiplication tables for 4.arrow_forwardLet S be the set of all bit strings (strings of 0's and I's) Select one: O A. f(s) = the string obtained by moving the first bit of s to the end of the string. (For example, f(1001101) = 0011011) O B. f(s) = the string obtained from s by interchanging 0's and I's. (For example, f(11000) = 00111) O c. f(s) the string & with a 1 bit appended at the end. (For example, f(1101) = 11011) O D. f(s) the reversal of s. (For example, f(110) = 011) length at least 2. Which of the following functions f : S → S is not onto S?arrow_forwardDetermine which characteristics of an algorithm the following procedures have and which they lack. procedure divide(n: positive integer) while n begin m := 1 /n n:=n - 1 endarrow_forward
- Let be a binary operation on N defined by a*b=a-b+ab^2, then find 4*5.arrow_forwardDetermine which characteristics of an algorithm the following procedures have and which they lack. procedure sum(n: positive integer) sum:= 0 while i<10 sum:= sum + iarrow_forwardQ9. Consider the following algorithm: sum = 0 For j starting at 1 and ending with 15: sum = sum + (8*j + 2) print(sum) What is printed as a result of executing this algorithm?arrow_forward
- The bit XOR of the bitwise 011001 and 100101 is O 111100 O none of the choices 110011 001111 O 001101arrow_forwardA binary string is a word containing only Os and 1s. In a binary string, a 1-run is a non-extendable substring containing only 1s. Given a positive integer n, let B(n) be the number of 1-runs in the binary representation of n. For example, B(107) = 3 since 107 in binary is 1101011 which has exactly three 1-runs. What is the following expression equal to? B(1) + B(2) + B(3) + ... + B(255)arrow_forwardplz provide handwritten answer for question 7 asaparrow_forward
- Elements Of Modern AlgebraAlgebraISBN:9781285463230Author:Gilbert, Linda, JimmiePublisher:Cengage Learning,Algebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:CengageLinear Algebra: A Modern IntroductionAlgebraISBN:9781285463247Author:David PoolePublisher:Cengage Learning
- Algebra: Structure And Method, Book 1AlgebraISBN:9780395977224Author:Richard G. Brown, Mary P. Dolciani, Robert H. Sorgenfrey, William L. ColePublisher:McDougal Littell