Hash table

Data structure that stores Value in a key

When to use ?

  • speed up dramatically because data can be retrieved directly from the key

  • Python Dictionary Type is the example

  • Usually used after pre-creating the size of the hash table in an array (a technique for exchanging space and search time).

Terms

  • ํ•ด์‰ฌ(Hash): ์ž„์˜ ๊ฐ’์„ ๊ณ ์ • ๊ธธ์ด๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๊ฒƒ

  • ํ•ด์‰ฌ ํ…Œ์ด๋ธ”(Hash Table): ํ‚ค ๊ฐ’์˜ ์—ฐ์‚ฐ์— ์˜ํ•ด ์ง์ ‘ ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•œ ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ

  • ํ•ด์‹ฑ ํ•จ์ˆ˜(Hashing Function): Key์— ๋Œ€ํ•ด ์‚ฐ์ˆ  ์—ฐ์‚ฐ์„ ์ด์šฉํ•ด ๋ฐ์ดํ„ฐ ์œ„์น˜๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ๋Š” ํ•จ์ˆ˜

  • ํ•ด์‰ฌ ๊ฐ’(Hash Value) ๋˜๋Š” ํ•ด์‰ฌ ์ฃผ์†Œ(Hash Address): Key๋ฅผ ํ•ด์‹ฑ ํ•จ์ˆ˜๋กœ ์—ฐ์‚ฐํ•ด์„œ, ํ•ด์‰ฌ ๊ฐ’์„ ์•Œ์•„๋‚ด๊ณ , ์ด๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•ด์‰ฌ ํ…Œ์ด๋ธ”์—์„œ ํ•ด๋‹น Key์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ ์œ„์น˜๋ฅผ ์ผ๊ด€์„ฑ์žˆ๊ฒŒ ์ฐพ์„ ์ˆ˜ ์žˆ์Œ

  • ์Šฌ๋กฏ(Slot): ํ•œ ๊ฐœ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•  ์ˆ˜ ์žˆ๋Š” ๊ณต๊ฐ„

Last updated