English subtitles

← Update - Intro to Computer Science

Get Embed Code
2 Languages

Showing Revision 5 created 05/25/2016 by Udacity Robot.

  1. So for the last step in implementing our hash table. Your
  2. goal is to define a procedure, we'll call it hashtable_update. It takes
  3. three inputs the hash table, the key, and the value. And
  4. what it should do is update the value associated with that key.
  5. So if the key is already in the table, then instead
  6. of creating a new entry like were doing before with add. What
  7. we want to do is change the value associated with that key,
  8. to be the new value that's passed in. If it's not already
  9. in the table, then what we want to do is
  10. add a new entry, that has that key associated
  11. with this value. This is going to be a pretty
  12. complicated procedure. I think it's the most complex procedure you've
  13. been asked to define so far. But if you
  14. think about it carefully and put together all the things
  15. we've seen so far, and understand how the hash-table
  16. works, I think you'll be able to define it yourself.