how to count in binary
For unlimited access to Homework Help, a Homework+ subscription is required.
State true/false: "Binary search requires that the array should be sorted to perform a search."
29. Consider the Cocktail Sort (code 4) algorithm described in the appendix. What is the fewest number of lines of code that would have to be added, removed, or changed in order for this algorithm to sort from largest to smallest? (A) Everything inside the second for loop. (B) 3 (C) 1 (D) 2 (E) Everything inside both for loops. Binary answers For the following questions you are to use your choices as they were the representation of a binary number. More precisely, A = 24, B = 23, C = 22, D = 21, and E = 20 position in a base 2 number. For example if you wanted to answer the number 23, you would translate it first as base 2 number, which is 10111, you would blacken A, C, D and E.2 Lets look at this process on your answer sheet, we have these 5 circle you can blacken. Normally you only pick one, here you might have to blacken more than one! @ ® © D ® Following the previous example, the answer we want to input is 23, its binary representation is 10111, hence the circle you would blacken are the following:
18. (2 points) Assume that there is a global array of integers named data, write a code fragment that will count the number of zeros stored in the array and print out the count.