Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

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)
I got my questions answered at in under 10 minutes. Go to 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


Get your free account and access expert answers to this and thousands of other questions

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.
i couldn't tell what they wanted - i implemented build_coder() then build_encoder is just: return build_coder(shift)
and of couse, build decoder is just: return build_coder(-shift)

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

@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.
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.

Not the answer you are looking for?

Search for more explanations.

Ask your own question