ferjulyerly7id ferjulyerly7id
  • 12-12-2016
  • Computers and Technology
contestada

Write a recursive, int -valued function, len, that accepts a string and returns the number of characters in the string .

Respuesta :

rsmith6559
rsmith6559 rsmith6559
  • 21-12-2016
Without knowing the language, it's pretty imposible to write it.  Once you start thinking recursively, it's not a difficult problem.

While you're recursing, pass the string without the first character.
The base case would be a null string which would return 0.
The unwind would just add one and return that.
Answer Link

Otras preguntas

If a store credit account charges 1.5% interest each month, what is the APR?
let f(x)=2x+2. solve f^-1(x) when x=4.
What does the random variable (r) for a binomial experiment of n trials represent?
If a store credit account charges 1.5% interest each month, what is the APR?
Which choice is equivalent to the expression below? 5x sqrt 2 - 2 sqrt 2 + 2x sqrt 2 A. 7x sqrt 2 - 2 sqrt 2 B. 2x^2 sqrt 2 C. 3x sqrt 2 D. 7x^2 sqrt 2
Helen Grey By Christina Georgina Rossetti Because one loves you, Helen Grey, Is that a reason you should pout, And like a March wind veer about, And frown, and
For what values of the variable is each rational expression undefined2x-3/2x-1( step by step please)
For what values of the variable is each rational expression undefined2x-3/2x-1( step by step please)
let f(x)=2x+2. solve f^-1(x) when x=4.
If a store credit account charges 1.5% interest each month, what is the APR?