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

the force it would take to accelerate a 900kg catr at the rate of 3m/s2 is
oftentimes criminals are diagnosed with?
Natural selection directly affects which of the following? a. alleles b. genes c. phenotypes d. mutations
why is it important to not get distracted while driving?
Write the equation, in slope-intercept form, of the line that has a slope of 2 and passes through the point (3, 1).
which equation shows the point-slope form of the line that passes through (3, 2) and has a slope of 1/3 ?
The us president whose economic policies were connected to the teapot dome scandal was theodore roosevelt. warren g. harding. calvin coolidge. franklin roosevel
If 200g of fat is used for 8 cakes,how much is used for 3 cakes?
One way to prevent hypothermia is to         A. gradually acclimate your skin to the cold.   B. wear as many pieces of clothing as possible when exercising in
At the conclusion of the Spanish American war, the United States