anonymous
  • anonymous
PS4, Spring 2011: Looking at the sample code, I can't see why build_coder is necessary; it seems like it doesn't do anything build_encoder doesn't also do. (This appears to be confirmed by the solution set.) Am I missing something here?
MIT 6.00 Intro Computer Science (OCW)
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
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

e.mccormick
  • e.mccormick
I have not worked the MIT problem sets, but from looking at the psudocode in the PDF, it looks like the only difference is that build_coder allows for a positive or negative shift, and build_encoder only does a positive shift value. With this type of cypher, the build_coder would be more efficient. The decoding can be done with the same code by shifting the opposite direction. This reduces programming time.
anonymous
  • anonymous
i couldn't tell what they wanted - i implemented build_coder() then build_encoder is just: return build_coder(shift)
anonymous
  • anonymous
and of couse, build decoder is just: return build_coder(-shift)

Looking for something else?

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

More answers

e.mccormick
  • e.mccormick
@bwCA yah, pretty typical code reuse. So have people write the code once, but call it with logical names. Then the interface to the user just asks for the shift value and if you want to encode or decode. They don't need to know you wrote something only once.
anonymous
  • anonymous
Ah! That makes perfect sense. I shoulda thought the whole problem through, not just the first bit; would've made it a bit more intuitive. Thanks.

Looking for something else?

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