Ask Question

Write a recursive method in pseudo code that returns the number of 1's in the binary representation of n. use the fact that this equal to the number of 1's in the representation of n/2, plus 1, if n is odd.

+4
Answers (1)
  1. 13 July, 21:56
    0
    Int count (int num)

    if num==0 return 0;

    return (n&1) + count (n/2)
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a recursive method in pseudo code that returns the number of 1's in the binary representation of n. use the fact that this equal to ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers