zpostcode
hash table
Nov 16, 2024 1:39 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 >
dairy cattle breeds
  Cattle, at the initial stages of their domestication, produced a relatively small amount of milk, sufficient only to rear their calves. Early cattle breeding focused largely on meat production, and the development of high milk yield in cows was a later development. Dairy cattle breeds were eventually established by years of careful selection and mating of animals to attain desired...
Odd earthquake swarm in Central Europe hints at magma bubbling below the surface
An odd earthquake swarm on the border of Germany and the Czech Republic may hint at magma moving deep below the surface. The quakes are in Vogtland, a region known for regular, low-level earthquake swarms. These swarms tend to last several weeks and lead to mostly mild shaking. The largest known quakes from the area are around magnitude 4.5, said...
Weird blobs lurking near Earth's core may have been dragged from the surface
Strange blobs deep in Earth's middle layer may be chunks of ancient continental crust that have been dragged down by tectonic forces, new research suggests. These blobs, known as ultra-low velocity zones (ULVZs), have long puzzled scientists. They're deep in the mantle, near the boundary with Earth's core, so researchers can only glimpse them by studying earthquake waves as they...
paramilitary
  paramilitary, group or organization that operates outside a country’s formal military structure. Paramilitaries are typically modeled after military organizations and may have similar training and equipment. These groups often have political or ideological aims and may be involved in activities such as counterinsurgency, anti-terrorism, or internal security. They are often associated with governments but can also be used by non-state...
Information Recommendation
NREM sleep
  In full: non-rapid eye movement sleep (Show more) Also called: non-REM sleep (Show more) NREM sleep, one of two phases in the sleep cycle, considered the restful or quiet sleep phase. The other phase of the human sleep cycle is known as rapid eye movement (REM) sleep. A single sleep cycle, with both NREM and REM phases, lasts about 90...
Birkin bag
  Birkin bag, handbag produced by French luxury retailer Hermès and named after English model, actress, and singer Jane Birkin. First debuting in 1984, the Birkin bag (or simply “Birkin”) became a status symbol in the 1990s and has become known for its sizable price tag and its difficulty to purchase. The origin story of the Birkin bag has gained many...
Fairy Chimneys: The stone spires in Turkey that form 'the world's most unusual high-rise neighborhood'
QUICK FACTSName: Fairy Chimneys Location: Cappadocia, Central Anatolia, Turkey Coordinates: 38.660576078243686, 34.81971335767199 Why it's incredible: Both the place and its name are straight out of a fairy tale Turkey's fairy chimneys are natural yet surreal-looking spires up to 130 feet (40 meters) tall that were carved out of soft volcanic rock by the elements over millions of years. Thousands of...
sheep breeds
  Sheep were first domesticated from wild species by at least 5000 bce and are raised for their fleece (wool), milk, and meat. The flesh of mature sheep is called mutton while that of immature animals is called lamb. Of more than 200 breeds of sheep in existence in the world, the majority are of limited interest except in the localities...
beef cattle breeds
  All modern domestic cattle are believed to belong to the species Bos taurus (European breeds such as Shorthorn and Jersey) or Bos indicus (Zebu breeds such as Brahman) or to be crosses of these two (such as Santa Gertrudis). Beef cattle breeds as they are known today did not always exist, and many are of recent origin to meet an...
Collapse of Earth's magnetic field may have fueled evolution of life 600 million years ago
A near collapse of Earth's magnetic field may have paved the way for life to evolve past the microscopic stage. New research on ancient rocks from South Africa and Brazil suggests that Earth's magnetic field underwent a major weakening about 591 million years ago. This corresponds to a time period called the Ediacaran (about 635 million to 541 million years...
'The most critically harmful fungi to humans': How the rise of C. auris was inevitable
Fifteen years ago, scientists discovered a new species of deadly, drug-resistant fungus: Candida auris. It is now considered one of the most dangerous fungal pathogens on Earth. In this excerpt from What if Fungi Win? (Johns Hopkins University Press, 2024), author Arturo Casadevall looks at the rise of this deadly fungus, which could be the first to have emerged as...
Havana syndrome
  Also known as: anomalous health incidents (Show more) Havana syndrome, largely discredited medical condition reported among U.S. diplomats and other government employees stationed internationally. Havana syndrome was first publicized in 2016 following reports of an unidentified condition in officials at the U.S. embassy in Havana, Cuba. Reported symptoms of Havana syndrome include tinnitus (ringing in the ears) and headaches, often...