YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Adding Keywords - Intro to Computer Science

Get Embed Code
2 Languages

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

  1. So now we know how to find the right bucket. Let's

  2. look at how to define the add procedure. So we are going to
  3. first define add, we'll make hashtable add, that takes a hashtable,
  4. a word and a value. And first we'll define a simple version
  5. of that, that says we are going to add the new entry
  6. to the bucket even if it already exists. So we'll find the
  7. right bucket. And we'll add the new entry at the end. So
  8. your goal is to define a procedure, we'll call it hash table_add.
  9. Takes three inputs: a hash table, a key, which is the
  10. word, and a value, and it adds that key to the
  11. hashtable, making sure to put it in the correct bucket with
  12. the associated value that was passed in as the third input.