JoeM3388 JoeM3388
  • 03-04-2015
  • Computers and Technology
contestada

Give a recursive algorithm for finding the sum of the
first n odd positive integers.

Respuesta :

Hippalectryon
Hippalectryon Hippalectryon
  • 03-04-2015
I'm writing that in some sort of pseudocode; if you don't understand it, feel free to ask for more details in the comments.

function sumOdd(n)
    if n==1 then
        return 1
    end if
    return (sumOdd(n-1))+(n*2-1)
end function
Answer Link

Otras preguntas

A body of mass 2 kg is moving in the positive X-Direction with a speed of 4 m/s collides head on with an another body of mass 3 kg moving in the negative X-Dire
What Is a Cause-Effect Essay?
An elevator is used to either raise or lower sacks of potatoes. In the diagram, a sack of potatoes of mass 10 kg is resting on a scale that is resting on the fl
Calculate the de Broglie wavelength of an electron traveling at 3.0 × 107 m/s (me = 9.1 × 10-31 kg).
how will you describe the pathway of the oxygen n the breathing system?
ecrives 5 lignes sur les forets de france
where did the idea for it come from, what did sputnik do and can you think of anything else about sputnik,
where did the idea for it come from, what did sputnik do and can you think of anything else about sputnik,
why was sputnik important?
What is the Rosetta Stone?