A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 4 years ago

pset3 problem 1 countSubStringMatchRecursive Hello Are there any other approaches for writing recursive function in pset3 problem 1 http://dpaste.com/hold/692393/

  • This Question is Closed
  1. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Your solution is identical to mine. Now, I'm not qualified enough to say that there are definitely no other (significantly different #ambiguousqualifyingstatement) ways to do this, but I don't think there are. In any case, I think that this is the most concise recursive solution to the problem. Well done. @Everyone_else: I'd be happy to see other solutions if anyone else has one.

  2. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Hmm, I didn't look closely enough, but you could change one (very minor) thing. This would only change, very insignificantly I think, the run-time of your code and does not affect its accuracy. Technically, you can change your search to start at zz+len(key)+1 instead of zz+1, so you'll skip checking strings you know to be in the key. Not sure if this is even worth mentioning, but hey whatever. Definitely gj though

  3. maitre_kaio
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    That was my approach first, but then I realize it just depends on the way you specify the function. Let's say, for example, that the target is 'aaaa' and that the key is 'aa' - with swdalb version, count = 2 - with den2042 version, count = 3 The two versions are correct, since it's just different interpretations of the same specification. Obviously, it means that the specification is not precise enough and that in the real world we would need to improve it.

  4. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    here are two; both variations of a theme http://dpaste.com/693400/

  5. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thank you all for your responses. @bwCA it's great stuff

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

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.