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

Will anyone be kind enough to answer this
What did James the II do you gain absolute rule
A reason the Battle of Gettysburg was a key turning point was
Select all the correct answers. Which two reasons describe why authors create contrasts between characters or narrators in a text? to make the reader develop a
What was a purpose of the What was a purpose of the Compromise of 1850? It was used to admit California into the union. It settled on popular sovereignty in K
is x^2 + y^2 = 5 a function
The table shows the scores of a biology test in Mrs. Smiths class . Find the mean of the data without Kim’s score. A- 80 B- 87.2 C- 90 D- 84.5
What is the main purpose of the table of contents?
The cause of humanity's increased water consumption is an increased population. What is the effect?
Do you think everyone in America today is treated fairly all of the time? Why or why not?