zpostcode
hash table
May 2, 2025 2:33 PM

  hash table computer science Actions Cite verifiedCite While every effort has been made to follow citation style rules, there may be some discrepancies. Please refer to the appropriate style manual or other sources if you have any questions. Select Citation Style MLA APA Chicago Manual of Style Copy Citation Share Share Share to social media Facebook X URL https://www.britannica.com/topic/hash-table Give Feedback Feedback Corrections? Updates? Omissions? Let us know if you have suggestions to improve this article (requires login). Feedback Type Select a type (Required) Factual Correction Spelling/Grammar Correction Link Correction Additional Information Other Your Feedback Submit Feedback Thank you for your feedback Our editors will review what you’ve submitted and determine whether to revise the article.

  Print Cite verifiedCite While every effort has been made to follow citation style rules, there may be some discrepancies. Please refer to the appropriate style manual or other sources if you have any questions. Select Citation Style MLA APA Chicago Manual of Style Copy Citation Share Share Share to social media Facebook X URL https://www.britannica.com/topic/hash-table Feedback Written by Stephen Eldridge Stephen Eldridge is a writer and editor of fiction and nonfiction for all ages. Stephen Eldridge Fact-checked by The Editors of Encyclopaedia Britannica Encyclopaedia Britannica's editors oversee subject areas in which they have extensive knowledge, whether from years of experience gained by working on that content or via study for an advanced degree. They write new content and verify and edit content received from contributors. The Editors of Encyclopaedia Britannica Last Updated: Nov 5, 2024 • Article History Table of Contents Ask the Chatbot a Question Ask the Chatbot a Question hash table, in computer science, a dictionary that maps keys to values using a hash function. A hash function is a mathematical function that maps data of arbitrary length to data of a fixed length. Hashing is a highly efficient way of performing certain operations, such as searches, insertions, and deletions. Hash functions are also widely used in cryptography, though not commonly in the form of hash tables.

  A hash table allows stored data to be retrieved from a table more quickly than a simple binary search of the data would allow, because the key being searched for is used to directly identify the index (row, or record) in the table that should be returned. For example, suppose one has a hash table designed to allow one to input a name and return a phone number. The hash table uses an algorithm to convert the name to a value of a fixed length that serves as the index for the table. Thus, hashing the key directs you to a specific place in the table to find the desired information.

  When more than one value is assigned to the same key, this is referred to as a collision. While collisions are not desirable, they are common and can be handled in different ways. One way is to have more than one value stored in a list at each index. This is called chaining. Multiple key values can be stored at the same index, and, when one of those keys is entered, it will be compared with the keys at the index until the correct one is found. Another method is called open addressing. In open addressing, when a collision occurs, one key is moved to a different open slot in the hash table based on a particular search algorithm.

  With chaining, many keys can be divided among the indices. A key and its associated date can be deleted in the same way. Hashing can be effective at dividing up a large number of keys so that searches and other operations on even very large amounts of data go quickly.

  A well-designed hash table can have a time complexity of O(1), or constant time, meaning that the same number of operations will be required to perform the search regardless of how many keys are in the table.

Comments
Welcome to zpostcode comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
Recommend >
Brat Pack
     St. Elmo's FireActors (from left) Ally Sheedy, Judd Nelson, Emilio Estevez, Demi Moore, Rob Lowe, Mare Winningham, and Andrew McCarthy in the film St. Elmo's Fire (1985), directed by Joel Schumacher. An interview with Estevez, Lowe, and Nelson shortly before the film's release led to them being dubbed (along with several other actors) “the Brat Pack.”(more)Brat Pack, the name...
Chris Evert: A Life in Pictures
     Chris EvertChris Evert is the first tennis player—male or female—to win 1,000 singles matches.(more) From her first professional match at age 15 until her retirement 20 years later, Chris Evert had a tennis career that was nothing short of remarkable. Here are just a few of her accomplishments:   55-match winning streak before she turned 21 years old18 Grand Slam...
Blue Mosque
     Blue MosqueBlue Mosque, Istanbul, Turkey.(more)Blue Mosque, 17th-century mosque that is one of the most magnificent structures of the Ottoman Empire, set next to the Byzantine Hippodrome and across from the Hagia Sophia in Istanbul, Turkey. Known for having six minarets (rather than the standard four) and for its many domes and semidomes, the building became known as the Blue...
Castellammarese War
  Castellammarese War, conflict between the Castellammarese and Masseria organized crime families in New York City from 1930 to 1931 that ultimately led to the reorganization of the Mafia. The Castellammarese family was led by Salvatore Maranzano, who was born in the Sicilian town of Castellammare del Golfo. The Masseria family was led by Giuseppe (Joe) Masseria.   During Prohibition, bootlegging was...
Information Recommendation
Battle of Monte Cassino
  Battle of Monte Cassino, battle at Cassino, Italy, during World War II from January 17 to May 18, 1944, between Allied forces and Nazi Germany. It resulted in the destruction of the town and its historic Benedictine monastery.   Allied progress up the “boot” of Italy had ground to a halt during the winter of 1943–44, thwarted by the Nazis’ Gustav...
Cabaret
  Cabaret, acclaimed stage musical by composer John Kander and lyricist Fred Ebb that explores the decadence of Berlin during the Weimar Republic amid the rising threat of Nazism. Set in a seedy cabaret called the Kit Kat Klub in 1929–30, the innovative musical tells the story of two doomed romances set against the emergence of anti-Semitism and fascism in Germany....
Battle of Yarmouk
  After a devastating blow to the Sassanid Persians at Firaz, Muslim Arab forces under the command of Khalid ibn al-Walid took on the army of the Christian Byzantine Empire at Yarmouk near the border of modern-day Syria and Jordan. The Battle of Yarmouk, which began on August 20, 636, was to continue for six days.   After the victory at Firaz,...
Contact
     Carl SaganCarl Sagan (1934–96), American astronomer and science writer.(more)Contact, science-fiction novel by Carl Sagan, published in 1985.   (Read Carl Sagan’s Britannica entry on extraterrestrial life.)      Britannica Quiz Famous Novels, First Lines Quiz Sagan, an astronomer at Cornell University who was inextricably tied to the search for extraterrestrial intelligence (the SETI program), was one of the most famous popular...
Cloud Atlas
     David MitchellBritish author David Mitchell at the Frankfurt Book Fair October 10, 2007. ©Torsten Silz—DDP/AFP/Getty Images(more)Cloud Atlas, novel by David Mitchell, published in 2004.   Cloud Atlas is a polyphonic compendium of interlacing but nonlinear parables. Divided into six different accounts spanning several centuries, Mitchell ranges from the journal of a 19th-century American notary to the post-apocalyptic memoir of a...
Boycott, Divestment, Sanctions
  Boycott, Divestment, Sanctions, (BDS), decentralized Palestinian-led movement of nonviolent resistance to Israel’s treatment of Palestinians. The movement advocates punitive measures against the state of Israel, including boycotts, divestment, and economic sanctions. BDS initiatives demand an end to Israel’s occupation of the West Bank (including East Jerusalem), the Gaza Strip, and the Golan Heights, the granting of full equality to Palestinian...
Beethoven Piano Sonatas
     Ludwig van BeethovenLudwig van Beethoven, lithograph after an 1819 portrait by Ferdinand Schimon, c. 1870.(more)Beethoven Piano Sonatas, compositions by Ludwig van Beethoven. Although he was far from the first great composer to write multi-movement compositions for solo piano, he was, nonetheless, the first to show how much power and variety of expression could be drawn forth from this single...
capital punishment in the United States
  Capital punishment is legal in some U.S. states and not legal in others. In some states it has been officially or effectively put on hold as a result of gubernatorial actions. The map and table below indicate the legal or effective status, methods, and recent history of capital punishment in each of the 50 U.S. states and the District of...