anonymous
  • anonymous
pset 3 #1 i managed to make the iterative program, but how do i make the recursive program?
MIT 6.00 Intro Computer Science (OCW)
schrodinger
  • schrodinger
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset3.pdf
1 Attachment
anonymous
  • anonymous
and just to clarify: iterative involves a while loop, and recursive contains a command within a function to repeat that function again?
anonymous
  • anonymous
What I did for pset 3a recursive was I used find on the first line and on the second I did return if x!=-1 and your function with the arguments target[x+1:],key and then add 1 to keep track of how many times it found it. That is not correct syntax thats just to put you on right track. The target[x+1:] is so that the next function will start at the position after the last found solution and go to the end.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
ok i did it, but it involves a global variable which im afraid breaks the rules of it being strictly recursive.
1 Attachment
anonymous
  • anonymous
i just don't get how you have a counter in a recursive function, because you have to set it to zero in the beginning, right? and if its recursive, it will reset itself to zero every time.
anonymous
  • anonymous
Sorry wrong attachment: heres the right one
1 Attachment
anonymous
  • anonymous
never mind got it
anonymous
  • anonymous
Hey can you post your final code?
anonymous
  • anonymous
1 Attachment
anonymous
  • anonymous
Ok cool here is what I did. Idk which is "better" but mine is shorter. http://dpaste.com/hold/529915/

Looking for something else?

Not the answer you are looking for? Search for more explanations.