zpostcode
hash table
Jan 10, 2025 3:02 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 >
presidencies in British India: Bombay, Madras, and Bengal
  presidencies in British India: Bombay, Madras, and Bengal, in British India, provinces under the direct control and supervision of, early on, the East India Company and, after 1857, the British government. The three key presidencies in India were the Madras Presidency, the Bengal Presidency, and the Bombay Presidency.   Those provinces were centered on the cities of Madras (now Chennai), Calcutta...
Resurrection Symphony No. 2 in C Minor
     Gustav MahlerResurrection Symphony No. 2 in C Minor, symphony by Gustav Mahler, known as “Resurrection.” The first three movements were heard in Berlin on March 4, 1895; the premiere of the complete work would not occur until December, again in Berlin. The premiere of Mahler’s Symphony No. 1 in D Major, from six years earlier, had been considered unusually...
rogue wave
  rogue wave, a relatively unpredictable and unexpectedly high water wave arising at the water’s surface and formed from the coincidental stacking of multiple wind-driven wave crests passing through a single point or arising from a combination of waves and currents that may shorten the waves’ frequency. Rogue waves tower to heights greater than twice the size of nearby waves, and...
Maria Skłodowska-Curie Museum
     The Maria Skłodowska-Curie MuseumThe Maria Skłodowska-Curie Museum in the replicated town house in which Marie Curie was born in Warsaw, Poland.(more)Maria Skłodowska-Curie Museum, institution dedicated to the life and work of Marie Curie located in a gracious town house in the New Town district of central Warsaw, Poland. The house is a replica of the 18th-century house in which...
Information Recommendation
Requiem in D Minor, Op. 48
     Gabriel FauréGabriel Fauré, portrait by John Singer Sargent; in a private collection.(more)Requiem in D Minor, Op. 48, composition by Gabriel Fauré. Begun in 1877 and largely composed in the late 1880s, the work was not completed until 1900. Unusually gentle for a requiem mass, the work is often reminiscent of the composer’s best-known work, the restful and graceful Pavane...
Second Battle of Fort Wagner
  Second Battle of Fort Wagner, unsuccessful Union assault on July 18, 1863, during the American Civil War (1861–65) on Confederate-held Fort Wagner on Morris Island, South Carolina. An early assault on the fort on July 11 (the First Battle of Fort Wagner) had been just as unsuccessful. Despite the Union defeats, the second battle was especially noteworthy for the courageous...
Makar Sankranti
  Makar Sankranti, Hindu festival in January celebrating the entrance of the sun into the astrological sign of makara (corresponding to Capricorn) and the beginning of the sun’s uttarayana (northward journey).   Makar Sankranti occurs on January 14 (or 15 during a leap year). Unlike most other holidays in Hinduism that are determined according to the lunisolar Hindu calendar, this festival is...
President’s Emergency Plan for AIDS Relief
  President’s Emergency Plan for AIDS Relief (PEPFAR), public health initiative launched by the United States in 2003 to coordinate an international response to the HIV/AIDS pandemic. The President’s Emergency Plan for AIDS Relief (PEPFAR), authorized by U.S. Pres. George W. Bush, marked a major step forward in global efforts to prevent HIV infection and to provide treatment to persons living...
Native American Graves Protection and Repatriation Act
  Native American Graves Protection and Repatriation Act (NAGPRA), U.S. law that regulates the handling of Indigenous human remains and cultural items. Passed in 1990, the Native American Graves Protection and Repatriation Act (NAGPRA) requires federal agencies and institutions that receive money from the federal government to return remains and cultural objects of Indigenous peoples in what is now the United...
MySQL
  MySQL, open-source relational database management software, owned by the computer software company Oracle, that allows users to interact with large amounts of data across multiple databases. MySQL is one of the most popular database management programs used worldwide.   Though SQL is sometimes referred to as “S-Q-L,” it is more often called “sequel,” in acknowledgment of its historical roots as “Structured...
Operation Torch
  Operation Torch, major Allied amphibious operation in French North Africa during World War II. It began on November 8, 1942, with the landing of 107,000 British and U.S. troops at Casablanca, Morocco, and the Algerian cities of Algiers and Oran. French authorities concluded an armistice with the Allies three days later. The landings, which came days after the victory of...
Mulholland Drive
     Naomi Watts (left) and Laura HarringPublicity still from the 2001 film Mulholland Drive, featuring Naomi Watts (Betty Elms/Diane Selwyn) and Laura Harring (Rita/Camilla Rhodes).(more)Mulholland Drive, American surrealist thriller and neo-noir film, released in 2001, that is considered one of director David Lynch’s finest works. The movie is noted for its dreamlike, nonlinear structure and its exploration of the dark...