Grokking Algorithms



Download 6,4 Mb.
Pdf ko'rish
bet79/120
Sana21.12.2022
Hajmi6,4 Mb.
#893167
1   ...   75   76   77   78   79   80   81   82   ...   120
Bog'liq
Grokking Algorithms An Illustrated Guide for Programmers and Other

EXERCISES
8.6
A postman needs to deliver to 20 homes. He needs to ind the 
shortest route that goes to all 20 homes. Is this an NP-complete 
problem? 
8.7
Finding the largest clique in a set of people (a 
clique
is a set of people 
who all know each other). Is this an NP-complete problem?
8.8
You’re making a map of the USA, and you need to color adjacent 
states with diferent colors. You have to ind the minimum number 
of colors you need so that no two adjacent states are the same color. 
Is this an NP-complete problem?


160
Chapter 8
 
 
I
 
 
Greedy algorithms
Recap
• Greedy algorithms optimize locally, hoping to end up with a global 
optimum. 
• NP-complete problems have no known fast solution. 
• If you have an NP-complete problem, your best bet is to use an 
approximation algorithm. 
• Greedy algorithms are easy to write and fast to run, so they make 
good approximation algorithms.


161
In this chapter
• 
You learn dynamic programming, a
technique to solve a hard problem by
breaking it up into subproblems and
solving those subproblems irst.
• 
Using examples, you learn to how to come up
with a dynamic programming solution to a
new problem.
dynamic
programming
9
The knapsack problem
Let’s revisit the knapsack problem from chapter 8. 
You’re a thief with a knapsack that can carry 4 lb 
of goods.


162
Chapter 9
 

Download 6,4 Mb.

Do'stlaringiz bilan baham:
1   ...   75   76   77   78   79   80   81   82   ...   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