Ask your own question, for FREE!
Computer Science 13 Online
OpenStudy (anonymous):

Hey guys, I am now at a total loss on Problem #4 of pset 4. This is now the best I can do: http://pastebin.com/p6DBjgi9 It has two serious issues: 1. After it decodes a scrambled string, it continues trying to decode it with the remaining shifts in the loop. I've tried breaking out of the loop with True/False statements, to no avail. It's something in the recursion, I'm sure. I sense that it has something to do with something I really didn't implement from the pseudocode, which is that shifts and start points aren't returned until the end of the string, at which point it returns (cont'd in comments)

OpenStudy (anonymous):

(My post was cut off with no warning. For a CS class on cutting edge educational technology, this website has some serious flaws. But to continue:) ...all the preceding shifts and start points, but I haven't figured out how to implement something like that. 2. Actually, I think this is a problem with the algorithm they provide in the pseudocode rather than a problem with my implementation of it: if you get a false positive (as with the apparently very common "I ", which is technically a valid word), the rest of the string is likely to be uncodable, and the pseudocode says just to return "None." This seems woefully inadequate. How can one "undo" the previous recursive function to complete the decoding?? Any help will be much appreciated!!

OpenStudy (anonymous):

Okay, I think I've realized a way to undo the previous call to the function, but it seems strange that they wouldn't mention it in the pseudocode.

OpenStudy (anonymous):

an occurrence of the letter 'i' does not mean that the word 'i' has been found. The letter 'i' with a space on either side of it does.

OpenStudy (anonymous):

yes, that's what I meant and didn't clarify.

OpenStudy (anonymous):

my point was that you shouldn't have false positives, because there is not another combination of letter and space with the same distance between the two so that a Caesar shift will result in the same pattern of 'i' followed and preceded by a space, but I was trying to avoid spelling it all out, for lack of a better phrase.

OpenStudy (anonymous):

oh, i see. There isn't for just those two characters, but there must be for more than two characters (i.e. "i_" are the coded first two letters of a word), because I've noticed it multiple times....

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!