Asked by Nikolay

Give a recursive definition of the function ones(s) which counts the number of ones in a bit string s.

Answers

Answered by MathMate
Is it a pseudocode or algorithm that you are looking for?

Counting the number of ones in a string of size n is of order O(n), whether by a recursive function or by marching, since every bit has to be examined.

There are no AI answers yet. The ability to request AI answers is coming soon!

Related Questions