In computer science, a data structure is a way to store and organize your data so you can access or operate on this information effectively. Hash Table is a type of data structure. In other languages, they can be referred to as dictionary, hash map or map. Hash tables are useful to do quick looks ups on a set of data. They are a quick way to implement mappings of key value pairs.
Sound familiar? JavaScript Objects! Under the hood, objects are constructed by hash tables essentially.
From a high overview, hash table consists of:
This simple example below stores people’s phone numbers for quick lookup.
Apparently, constructing a hash function is not something we need to do. They are created by really smart folks with PhD’s who wrote a hash function that magically breaks down our key input into an index, based on provided storage size. The internet is a place we can search for a good hash function to leverage. In general, a good hash function:
#bootcamp #data-structures #hash-table #javascript #coding