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

what is the value of p in the equation 4p 3(p 4) = 12p 12? 12 1 0 −1
All of the following are types of outlines except __________. a. long b. decimal c. full sentence d. alphanumeric
Data collection relies entirely on scientific experiments? true or false
how does an author use cause-and-effect relationships to drive the plot of a story?
How do you find the slope of a line perpendicular to a given line?
what woman could not do that men could do in ancient rome
This page from a medieval manuscript represents not only the power of the Church but also the skill of medieval scribes benefits of the printing press poor l
How do plants play an important role in preventing wind erosion
Flowers of orchid species Ophrys bombyliflora look and smell like female bumblebees. This attracts the male bumblebees flying nearby to the flowers. Thus, polle
what is the distance between -2 and -8 on a number line