Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 18 Online
OpenStudy (anonymous):

Anyone else having difficulty with problem set 4 problem 4( the multi-level Caesar cipher)?

OpenStudy (e.mccormick):

What probelm is it giving you?

OpenStudy (anonymous):

well, it says use the <start> parameter as a base case. Well, actually it says what value of start is a good base case. then it says it is 'NOT' zero. So I've been trying to think of a good base case for the func, but just cant seem to get it. I went on to lecture 14/15, n left out prob set4 at the end, but i really wanna finish it. So i revisited the recitation videos and lecture videos from start in hope that i missed something, or i would have a 'eureka moment'. Hasn't happend yet. lol. And then are we meant to apply the shifts as negative ints(when using apply_shifts function)?

OpenStudy (e.mccormick):

Can you link the question? I don't remember which version of the class that one is in.

OpenStudy (turingtest):

You can make the cipher without too much trouble with a bit of careful modular arithmetic; just remember your ascii chart. You are going to work in two ranges: upper and lower case (notice in ascii they differ by only one binary bit). one range is from 'A' - 'Z' (remember that in single quotes, chars are basically ints in disguise) and the next is from 'a'-'z'. The lowest number you should ever access in the ascii chart is 'A', which I think is 65, but that's not important to remember. use modular arithmetic to make sure you never change a number that starts of capitalized to be numerically outside the range 'A'-'Z', and one that starts of lowercase to never go outside the numerical range 'a'-'z'. Since when we get to the end of the alphabet, we want to "wrap around", what number should we modulo by?

OpenStudy (anonymous):

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/unit-2/lecture-10-hashing-and-classes/MIT6_00SCS11_ps4.pdf...that's the instruction file. I've written the code for build_coder() function and everything else up to that point. So applying the shift is no problem. And I did the problem with finding the shift, when it was one level.( so just one shift across the text)

OpenStudy (anonymous):

and also, the problem with the code for applying multi-level shifts I did.

OpenStudy (anonymous):

france, have you find the answer to problem 4 yet? I'm stuck on this problem as well, I don't understand how I can get a list of "shift tuples" out of this function, or write the recursive function. I understand what I have to do, but can't translate it into code

OpenStudy (anonymous):

I've spent a significant amount of time on this problem as well, but I can't solve it. My approach was to look for the best case where you found the most words in the string, then send the string through a recursive call using the starting point of the best case. From that point, it would get the best shift for the string at the starting point, look for another bad word in the current string, and resend it through the recursion until it reached the end of the string. Finally, I would send the first half of the string through the recursion loop to find the shifts for the first half. It works great on short strings but it's failing on larger strings. I can't figure out why. Here is my solution. Thoughts/additions appreciated.

OpenStudy (anonymous):

vincent - no I have not looked at the problem again in a while. What about you any luck? WHat were you using as your base case? thodges - I didn't actually do it that way, i was having a go at looking at it that way. Cuz I thought about using a loop in the non-recursive part of find best shifts, but then I ended up obliviously finding a space and words, but they were like 'a, an, I' and other short words, or words were the sentance made no sense at all

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!