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

food couldn't reach the stomach without the esophagus and the what
I would like to know if 1 km is greater or less then 999 m
Force and Motions: Pushes and pulls of all kinds are________.
State whether the following is an example of inductive reasoning or deductive reasoning You have a summer job as a mechanic’s helper. The mechanic asks you loos
Why was Emmeline Pankhurst significant?
A person sees a ball and kicks it, in part because of actions of the nervous system. Using the parts of the nervous system listed bellow, describe the path of n
What is the complete predicate of the following sentence?sharon and Jason went for a walk then a bike ride
You work at a fruit market. Bananas cost 50¢ a pound. A customer hands you a bunch of bananas that weighs 3 pounds. How much should you charge for the bunch o
What role should the government have in enforcing equal rights for Americans?
I am so confused about this graphing problem, just need answer doesn't have to show workRectangle ABCD has a length of 9 and a width of 7. Point D is the ordere