Grokking Algorithms


A phonebook where the keys are names and values are phone  numbers. he names are as follows: Esther, Ben, Bob, and Dan. 5.6



Download 6,4 Mb.
Pdf ko'rish
bet51/120
Sana21.12.2022
Hajmi6,4 Mb.
#893167
1   ...   47   48   49   50   51   52   53   54   ...   120
Bog'liq
Grokking Algorithms An Illustrated Guide for Programmers and Other

5.5
A phonebook where the keys are names and values are phone 
numbers. he names are as follows: Esther, Ben, Bob, and Dan.
5.6
A mapping from battery size to power. he sizes are A, AA, AAA, 
and AAAA.
5.7
A mapping from book titles to authors. he titles are 
Maus

Fun 
Home
, and 
Watchmen
.
Recap
You’ll almost never have to implement a hash table yourself. he 
programming language you use should provide an implementation for 
you. You can use Python’s hash tables and assume that you’ll get the 
average case performance: constant time.
Hash tables are a powerful data structure because they’re so fast and 
they let you model data in a diferent way. You might soon ind that 
you’re using them all the time:


94
Chapter 5
 
 
I
 
 
Hash tables
• You can make a hash table by combining a hash function
with an array.
• Collisions are bad. You need a hash function that
minimizes collisions.
• Hash tables have really fast search, insert, and delete.
• Hash tables are good for modeling relationships from one
item to another item.
• Once your load factor is greater than .07, it’s time to resize
your hash table.
• Hash tables are used for caching data (for example, with
a web server).
• Hash tables are great for catching duplicates.


95
In this chapter
• 
You learn how to model a network using a new, 
abstract data structure: graphs.
• 
You learn breadth-irst search, an algorithm you 
can run on graphs to answer questions like,
“What’s the shortest path to go to X?”
• 
You learn about directed versus undirected graphs.
• 
You learn topological sort, a diferent kind of
sorting algorithm that exposes dependencies 
between nodes.

Download 6,4 Mb.

Do'stlaringiz bilan baham:
1   ...   47   48   49   50   51   52   53   54   ...   120




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish