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

Not all types of work are covered by a minimum wage. True False
Solve for t. −32=4t What is the answer? A −8 B −18 C 28 D 36
sequence the following terms from simplest to most complex: Organ system, Tissue, Organ, Organelle, Cell
D is not right its a negative 8 so therefore it would be minus
Please help # 4 thx bbbb
Escoge el participio correcto para el verbo. (abrir) Question 1 options: abrido aburrido abierto abró
What is the height of a triangle that has an area of 60 yd^2 and a base with a length of 12 yd
Which country has the most successful integrated pest management system in the world? India China Indonesia Russia
The width of Maya’s poster is 2 inches shorter than the length. The graph models the possible area (y) of Maya’s poster determined by its length (x). Which des
What are the potential sources of materials thst are present in a tree