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

when we look at a leaf, we see the colors of light that are reflected off its surface. how does the relatively low flow of oxygen in green light?
Which is the same as 0.08? A) 80% B) 80/100 C) 8% D) 0.8
how might a scientist a determine  whether trait sex-linked by observing the offspring of several genetic crosses
How did the Declaration of Independence change the nature of the American Revolution?
How did Alexander the Great rise to power and how did he spread Greek culture to other lands?
What sorts of signals does the brain use to communicate sensations, thoughts and actions?
how is the expression of sex linked genes both  similar to and different from the expression of autosomal genes?
What culture believes health is harmony between man and nature?
Fragment in this sentenceWith her heavy dictonary, Donna thumps the top other ancient computer monitor.  Whenever the color tint flickers from normal to sickly
The gases in the air attracted to earth by gravity form layers called the ____