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 train is moving at 35 m/s to the east. it speeds up to 42 m/s east over the course of 40 seconds. what was trains acceleration
The highlighted word is a/an ________. Persevering is highlighted A) participle B) coordinating conjunction C) gerund D) modal
Create an equation. Use the graph below to create the equation of the rainbow parabola. Graph of a parabola opening down at the vertex 0 comma 36 crossing the x
LADY MACBETH. Come on; Gentle my lord, sleek o'er your rugged looks; Be bright and jovial among your guests to-night. William Shakespeare, Macbeth, Act III, sce
The British Reform Bill of 1867 extended the right to vote to __________.
how can you reduce the stress of completing a project
All of the following were key components of the Henry Clay's American System EXCEPT which one?
Who was Robert Oppenheimer?
How did the Spanish and French differ in their treatment of American Indians? The Spanish forced American Indians to convert to Christianity while the French bu
The middle layer of the urinary bladder is identified as ___________. a. Mucous coat b. Submucous coat c. Muscular Coat d. Sphincter Coat