4

So I'm in pset6 and my time is 0.01 seconds slower by the staff's implementation.

  1. Should I try to improve it more?
  2. Does it matter?
  3. If I should improve more how can I do it? Particularly in load as that's where I'm 0.02 seconds slower. My unload is 0.01 seconds faster.

(Sorry for the many questions...)

Sometimes they are equally fast. screenshot

2
  • Whether you should keep trying and whether it matters are 100% opinion, and how you can do it is impossible to answer without seeing your code (which you can't post publicly). Not the makings of a good question. If you could explain in pseudocode how your load works, then we might be able to help.
    – Air
    Jul 21 '14 at 16:16
  • @AirThomas it's ok now. I'm pretty content with the time my speller takes. For now my goal is to finish the CS50 and then, when/if I take the certificate I'm gonna try to implement the hacker editions and improve my code. (I have done the 2 first hacker editions but after the second I think things get a little difficult...) Jul 21 '14 at 22:03
2

Should I try to improve it more?

Yes, if you wish!

Does it matter?

It's meant to challenge the staff and yourself at the first place, so officially it doesn't matter.

If I should improve more how can I do it? Particularly in load as that's where I'm 0.02 seconds slower. My unload is 0.01 seconds faster.

If you're using a hashtable, then the hash function is the main place to do your work. It should decrease collisions as much as possible in the least possible time. Otherwise, try to reduce the steps (e.g., loop iterations) as much as possible, or maybe using another more complex data structure (this answer suggests few of them including hashtables and tries).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .