anonymous
  • anonymous
I just did ps3a and I created the iterative function. It works but if anyone has any suggestions on how to improve it and clean it up, please let me know. http://dpaste.com/hold/694021/
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
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.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
http://dpaste.com/hold/694122/
anonymous
  • anonymous
Ok! This is what I got for ps3a. I´m not sure if I understood correctly what it is that it asked for, since it was way too easy, in comparison to the last assignments, to get to it. def countSubStringMatch(target, key): x = target y = key z = 0 ctr = 0 while find(x,y, z) != -1: if find(x,y,z) == z: ctr += 1 z += 1 print ctr Can anyone please enlighten me on what it is that needs to be done so that I can get my butt kicked like I´m supposed to?
anonymous
  • anonymous
Oh! And while I´m at it, here´s my answer to PS3b: def SubStringMatchExact(target, key): x = target y = key z = 0 while find(x,y, z) != -1: if find(x,y,z) == z: print z z += 1 Again... I´m pretty sure I´m not doing what they´re asking of me. Can anyone help?

Looking for something else?

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

More answers

maitre_kaio
  • maitre_kaio
EFarias: your implementations give the right results, so it"s ok. Don't worry about the difficulty, the maths will come back soon ! Just a few notes: 1. You don't have to rename the parameters. Just use target and key in the function. 2. For substringMatchExact (but I guess it makes sense for the other functions too), you should return a value, not print it. 3. Your code is not very efficient, since in the while loop you are searching a first time for the key from pos z, if you find it, you continue to search it until the position where key is found is equal to z, incrementing z by 1 each time. You could do better by setting z to the right position.
anonymous
  • anonymous
what is your code for the recursive part of this same question
anonymous
  • anonymous
http://dpaste.com/hold/692393/
anonymous
  • anonymous
http://dpaste.com/693400/

Looking for something else?

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