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

Over half of the world’s known supply of oil is found in _____.
Although the American Federation of Labor worked to improve the lives of workers in the early twentieth century, they generally looked down on A. only blacks. B
at a sandwich shop there are different kinds of chips . there are 12 bags of potato chips . there are 9 bags of veggies chips . there are 9 bags of corn chips
voluntary deductions include ____. (1 point)
3. What term refers to a system in which one branch of government is prevented from seizing too much power? A. Electoral college B. Checks and balances
Which word in the sentence is the predicate nominative? Down the road, that dark shape might be a dog. A. dark B. dog C. shape D. road
Karim says the ratio of the distance he ran to the distance Shawn ran 4:3 give three possibilities for the distance each could have run
7(m-12)=5m a) -7 b) 6 c) 42 d) -42
How were the experiences of Jamestown settlers and pilgrims alike?how were they different
What is the minimum number of days that adults should do strength-training exercises each week?