zpostcode
hash table
Nov 3, 2025 8:53 AM

  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 >
Advent calendar
  Advent calendar Christmas custom Ask the Chatbot a Question Ask the Chatbot a Question Written and 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...
Tombs of Buganda Kings at Kasubi
     Tombs of Buganda Kings at Kasubi World Heritage site (more) Tombs of Buganda Kings at Kasubi royal burial ground, Uganda Ask the Chatbot a Question Ask the Chatbot a Question Also known as: Kasubi Tombs Written by Meg Matthias Meg Matthias is Senior Video Production Manager at Encyclopædia Britannica. Meg Matthias Fact-checked by The Editors of Encyclopaedia Britannica Encyclopaedia...
Ham
     Mercury-Redstone 2 Launch of Mercury-Redstone 2 on January 31, 1961, on a suborbital flight with the chimpanzee Ham on board. The flight paved the way for the first American astronauts. (more) Ham chimpanzee Ask the Chatbot a Question Ask the Chatbot a Question Written by Frannie Comstock Frannie Comstock is a writer based in Chicago. Frannie Comstock Fact-checked by...
Girl Scout Cookies
     Girl Scout Cookies Girl Scouts selling cookies at a stand in Midtown Manhattan, 2013. (more) Girl Scout Cookies food Ask the Chatbot a Question Ask the Chatbot a Question Written by Laura Payne Laura Payne is a freelance writer whose work covers many topics. She is a former Wayne State University linguistics instructor. Laura Payne Fact-checked by The Editors...
Information Recommendation
Anno Hideaki
  Anno Hideaki Japanese animator and film director Ask the Chatbot a Question Ask the Chatbot a Question Written by Adam Volle Adam Volle is a freelance writer and editor based in Atlanta, Georgia. Adam Volle 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...
Tyson Fury
     Tyson Fury English-born boxer Tyson Fury celebrating his victory over Dillian Whyte at Wembley Stadium in London, April 23, 2022. (more) Tyson Fury English-born boxer Ask the Chatbot a Question Ask the Chatbot a Question Also known as: Tyson Luke Fury, the Gypsy King Written by René Ostberg René Ostberg is an associate editor at Encyclopaedia Britannica. René Ostberg...
Pete Hegseth
     The next secretary of defense? Pete Hegseth appearing on Fox & Friends, 2019. (more) Pete Hegseth American TV personality Ask the Chatbot a Question Ask the Chatbot a Question Also known as: Peter Brian Hegseth Written by Amy Tikkanen Amy Tikkanen is Managing Editor at Encyclopaedia Britannica. Amy Tikkanen Fact-checked by The Editors of Encyclopaedia Britannica Encyclopaedia Britannica's editors...
challah
     Peter Paul Rubens: The Israelites Gathering Manna in the Desert The Israelites Gathering Manna in the Desert, oil on wood by Peter Paul Rubens, c. 1626–27; in the collection of the Los Angeles County Museum of Art, California. (more) challah bread Ask the Chatbot a Question Ask the Chatbot a Question Written by René Ostberg René Ostberg is an...
Miracle on Ice
     Miracle on Ice Members of the United States Olympic men's hockey team celebrating their remarkable victory over the Soviet Union's team at the 1980 Winter Olympic Games in Lake Placid, New York, on February 22, 1980. The Soviet Union's goaltender Vladimir Myshkin is at left. (more) Miracle on Ice Olympic hockey game Ask the Chatbot a Question Ask the...
Battle of Jaffa
     Richard I at Jaffa, 1192 Richard I (Richard Coeur de Lion) landing at Jaffa to lift the Saracen siege. © Photos.com/Getty Images. (more) Battle of Jaffa Middle Eastern history [1192] Ask the Chatbot a Question More Actions Print Cite verifiedCite While every effort has been made to follow citation style rules, there may be some discrepancies. Please refer to...
hashtag
     Hash ligature (left) written by Isaac Newton compared with a modern-day hash symbol (right) The original ligature stood for libra pondo, or “pound in weight,” which eventually evolved into the # symbol. (more) hashtag label Ask the Chatbot a Question Ask the Chatbot a Question Written by Laura Payne Laura Payne is a freelance writer whose work covers many...
Battle of the Medway
     Caractacus at the Tribunal of Claudius at Rome The Battle of Medway (43 CE) was the first major recorded battle of the Roman invasion of Britain under the orders of the emperor Claudius. The British force was led by two brothers: Togodumnus, king of the Catuvellauni, and Caratacus, a chieftain of the same tribe. Library of Congress, Washington, D.C....