Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
15 views
14 pages
week 12_LectureNote_watermark
INTRODUCTION TO ANALYSIS
Uploaded by
SandhyaKastala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save week 12_LectureNote_watermark For Later
Download
Save
Save week 12_LectureNote_watermark For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
15 views
14 pages
week 12_LectureNote_watermark
INTRODUCTION TO ANALYSIS
Uploaded by
SandhyaKastala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save week 12_LectureNote_watermark For Later
Carousel Previous
Carousel Next
Download
Save
Save week 12_LectureNote_watermark For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 14
Search
Fullscreen
Week 12- Lecture Notes Topics ‘ dynamic Frog ramnuning - memoizetion avd subproblems - Fivonaeei ] examples - Svrortest paths . questing and DAG views Computational Complexity Dynamite Frog ramming (vp) * Big idea, herd, yet simple. * Powerful algorithmic design technique . Lorge class of seeminglyvexponential problems have @ poly nomial soléHon (“only”) vie dP. Farticularty Foroptimizotion problems (minlmen) - Enomple: Shortest poths. A dynamic Programming i¢ o consoled brute- fore methool. Tt uses recursion end re-use, D6 “controlled. brute- force” DP a “recursion and re-use”Fibonacci Alumbers Filoonacei numbers ave of the Porm 0. 6. 8, -Me, : hes F-5 Goal: Compute Fy Noive Algori ton follows vecursive definition. fib (mn). iP ngo return $2) 2 else veturn 4: fibln) +4ibln-2) => Thode TLnei) + Tla-a) A Olt) » A =e" % 2Tln-2) oll) y gre Exponential BAS! nN / Ga) /\ J Gq) O& aMemoized bd? Algorithm memo = {3 fiw): z iF nm is in memo: return memoln] 3. else: if neQ: fel 4. else fe Holn-D stibln-2) memo LnJs £ ‘. teturn + * $0 Lk) only yecurses Pest time called VK = onlynveememvized cells : Keh2,c0n e memoired cells free ( OliSime) * OW Hime per col Wgworing yeeursion) Polynomial - GOop\ © DP x “recursion Smemoizetion” © memoize. (vemember) and ve-use solutions to Subproblems +net help solve problem — in Fibonacci , subprovlems are fy Fay---1 Fr = ptime + # subproblems » Lime per Subproblem) +Fionecei + # subproblems =n. Hime pey subproblems Ol) a Hime = O(n) Uignoring vecursions )Bottom-up dP Algoritam ' Hbe= Tf 2% for K im Lutyens 3 if K aes gel Bln) 4, else: Pe filo [ee] + fib le-27 | OL. 5 site) + F 6. Teturn fib tw) senactly the seme, computation ab memoized bP (recursion “unrotied ‘) cecumsion va ein general : tepelogical sort of sub problem dependency bag. . proctically jester: no secur sion : anely sis more olovious * Con save space: last afin > Ot)Shortest Paths + Recursive formulation Stun) emnin {uotv) + 5L6ud | tow) €€ J + Memoized DP algorithm : toked infinite Hme if cycles. (necessary to handle negative cycles) + Works for directed aeyelic glse) aphs iv ose) | ~(effectively v°5/ 5ts.09 topological gost + Gellman 1 Sls.) ford rolled into single recursion) $v) $lss) + Suloprotolem dependency Mould ve slo a Oeyclic « -more subproblems temove eyelie dependence SulSveNgvortest Sv path using & & edges ~ tecurrente? Selb) + min {Sur S0(S¥) = 0 for SHV | bose _ Sy (53) + 0 for amy " / aeeaee - goal » BU) = Sieg lv) iP no negative cyple e -—Mewoi ze ~time : # Subproblems - [¥ime per sulpzoblems) wiwt olv) 6 olv’) - actually 8 Uindeqree lw) jor Syl) =D>tme OVE indegree(a)) = OLVE) [4.u) avotuad | Ou) € J BEUMAN FoRS |Guessing How to design yecurrence ewart shortest Sov peth es whet is the last edge in path? den't Know s guess tt is (uv) path is shortest su poth + edge (uv) eee eee by opHmel substructure scott 18s isu) + uatuev) Ser Onother sulproblem, © to Find best quess, try all Cl choices) ond use best. o*key: small (pelymomial ) # possible quesses per Sub problem — typieally this dominates time] subproblem. * DP zx tecdRStOWeb memoi zation +quessing DAG view ~\ike replicating POs . graph to vepresent Hme ~ converting shortest He 2 peths in graph to shortest pots in BAG 7 "Dee shortest paths in some DAGSuen ary + DP & careful orute fore = quessing 4 vecursion + memoi cation = dividing into teasonolle y# suloproblems whose Solution relate - acyoliely - usually via questing ports of solution ctimes de suloproblems x [time per suproblem) —_ treating recursive calls os oli) Cusuelly wainly guessing ) - eosentially On amortization - Count each suloproblem only once ; ofter Pivst timey/costs OL) vie memoizetion “DP & Shortest pathy in some DAG.5 aby steps to Dynomie Geograrmming define subproblems count 4 subproblems queee (pert of solytion) count + choices telate suloproblem selutions compute time per subproblem feturse + memoize problems Hme + lime per suloprobele) o X® suoprovlems uild DP table betom-up cheek subproblems acyclic |+epologicel order. Solve original problem: => extva time = 0 Subproblem oR by wunking oubproblem solutions. Enomples Fitoona cet Shortest paths Sulopro blems on &, (ov) for VEN, 0 KE IVI Jordhe KE vi 2 ming sv poth using £ Kedges #subproblems ” v* guess viothing edge Into Lif ony) ¥ choice® L indleq reel) +1 Teeurrence Fe Feat Fea Bld) = vain V5 re Us,u) + wl? He per Sulproblem Bw Coe Fl i. ols indegree(™) logical ee for Keli 9 for Keo, Wie) for vEV fotel Hme etm) oe ™ . +OlV) unless efficient ebout original ee ee prdolem Fn Sy to9) dor vev entra ime 6) pv)C omp utational Compleaity definitions: Ps {problems solvable in (nt) time J (polynomial) EXP: { problems soluable in oo") time } (eaponentia) ak . { problems solvable in Pinite tiene 3 “recursive” lee SS ? ‘onal difficulty ee exe we & uncomputalole /) P g EFS R undeadeble Examples: negative - weight cycles detection EP hess EERE wut ¢P whe wins fram given load canFiguration | Tetris ¢ EXP but don't Know whether € P survive given pieces Prom given tooard. Given a computer program does it ever halt Lstop) ? * uncomputable ( ¢R) + no algoritim solver it (correctly in Binite me on all inputs) * decision problem: answer is YES or NOMost Decision foblems are Uncomputable + program x binary string x nonnegative integer EA) s decision problem = @ function Prom binary strings (= non- veg. intergers) to [YESin, No lor} oz inbnite sequewe of bits = real number ER WI
not nearly enough 78g yams fos all problems * ea0n program solves only one problem * => almost all problems cannot be solved NP NP: { Decision problems selveble in pelynowriel Hime via & \ucky alqoxttam} “The lucky algorithm con make . ” * e \ueky gueses, @lwoys right without trying oll options * nondeterministic model + a\qori thn makes gueses ond then says YES or NO * guesses queranteed to lead to YES outcome iP possible Example: Tetris ENP * nondetermini she algoritowm t quess each move, did 1 survive 1 + prooP oP Yes: Wot what moves to make (rules of Tetris are cosy )AP NPs {decision problems with solubens Hat con be checked” iw polynomial, Hime} => when answer is YES, it con be proved, and polyromial -time algorithm con check proof. —_— computation 7. diffi culty ne Ve ae ee, Ungomputable / undedidatole R P#AP —— Ikie a big Genyecbure (worth 41,000,000) + zconnot enginee? luck . £ generating (preots of) solutions con be herder then checking themHadness and completeness Claim: Tf PNP, then Tetris ENP P Pro? * Tetris is AP- hard = “es hard as” every problem ent Injoct . Tetris is AIP complete = NP i [NP-herd) NP- Ward a : Ex?- hard i _ Chess AP : ss Exe uncomputolde/ ba we undecidalole * Chess is CAP-tomplete = EXPN ExP-herd- ExP- hard is as hard as every protlem in GaP. TP NP # EXP, then Chess ¢ Ext\ne. Whether NP EXP ib also an open problem but less” Jomous /™ impo:Reductions Convert the problem into @ problem that i> already known Wow to solve | instead of solving Prom serateh) «© most Common algoritnun design technique + unweighted -shortest path > wei ghied (set weights) + min product path » shortest path [take 1095) * longest path + shortes path (megotive celea * shortest order four shortest path (x copies of the graph) + Cheapest leaky-tank path > Shortest path Pee 4 q (gre we teduchon) All of the aloove ave One-calli¥eductions: A problem ANB problem -+ Gsolubion — A solution Multcall seductionie: soove A using Free calls +> B, “in this "sense,every algorithwn reduces problem > modelo? computation ”N¢- Complete Problems NP- Complete problems ave ell interreducible usin Polynomial Hime teduchons (some difficulty) We can use reductions to prove NP-hardness Tetris. Ertamples of NP- Complete Peovolems « Knapsack ¢ 3- partition : given w integers, divide them into triples of equal sum? ° Travelling Selesmen Problem + ~ shortest path qhat visits all vertices fo oven, reyple is KL weight gal Pecision version) \ongest common “subsequence of Kk strings Mine sweeper, Soduku and most puzzles SAT : given @ Boolean jormula (end,or, not), is it ever true? ¢ Shortest paths amidst obstacles in SB * 3 coloring a given graph «Find largest clique in@ given q7eph-
You might also like
Dynamic Programming in Computer Science
PDF
No ratings yet
Dynamic Programming in Computer Science
49 pages
2024 CSC14111 Lecture03 Backtracking Merged
PDF
No ratings yet
2024 CSC14111 Lecture03 Backtracking Merged
170 pages
Final Notes Chapter1 7 1
PDF
No ratings yet
Final Notes Chapter1 7 1
19 pages
0.5Dynamic Programming-1
PDF
No ratings yet
0.5Dynamic Programming-1
48 pages
Local Search
PDF
No ratings yet
Local Search
17 pages
Chapter - 2: Fundamentals of Algorithmic Problem Solving
PDF
No ratings yet
Chapter - 2: Fundamentals of Algorithmic Problem Solving
23 pages
Algorithms
PDF
No ratings yet
Algorithms
501 pages
Lecture13_IO_BLG336E
PDF
No ratings yet
Lecture13_IO_BLG336E
58 pages
Daaunit 4
PDF
No ratings yet
Daaunit 4
28 pages
day6_-_upt-cours-complexity
PDF
No ratings yet
day6_-_upt-cours-complexity
30 pages
Recursion: Breaking Down Problems Into Solvable Subproblems
PDF
No ratings yet
Recursion: Breaking Down Problems Into Solvable Subproblems
26 pages
Lecture 1 DP
PDF
No ratings yet
Lecture 1 DP
55 pages
2024 CSC14111 Lecture03 Backtracking
PDF
No ratings yet
2024 CSC14111 Lecture03 Backtracking
29 pages
d60d7cc837f222bb92e5982efdf3823c_TDo3r5M1LNo
PDF
No ratings yet
d60d7cc837f222bb92e5982efdf3823c_TDo3r5M1LNo
14 pages
Class 55
PDF
No ratings yet
Class 55
29 pages
DAA Unit-5 - Merged
PDF
No ratings yet
DAA Unit-5 - Merged
17 pages
SE-Comps SEM4 AOA-CBCGS DEC19 SOLUTION
PDF
No ratings yet
SE-Comps SEM4 AOA-CBCGS DEC19 SOLUTION
19 pages
Week 8 leacture
PDF
No ratings yet
Week 8 leacture
89 pages
KCS503 Solution Session 2022-23
PDF
No ratings yet
KCS503 Solution Session 2022-23
18 pages
28, 31Dynamic Programming (Fibonacci) (Dynamic Knapsack)
PDF
No ratings yet
28, 31Dynamic Programming (Fibonacci) (Dynamic Knapsack)
75 pages
0282 Algorithms (1)
PDF
No ratings yet
0282 Algorithms (1)
90 pages
UNIT 4 NOTES (5)
PDF
No ratings yet
UNIT 4 NOTES (5)
15 pages
Daa Unit-Iii
PDF
No ratings yet
Daa Unit-Iii
16 pages
Vdoc.pub Discrete Optimization Spring 2015
PDF
No ratings yet
Vdoc.pub Discrete Optimization Spring 2015
82 pages
Lec13 Dynamic Programming
PDF
No ratings yet
Lec13 Dynamic Programming
47 pages
L19_all
PDF
No ratings yet
L19_all
22 pages
NPC - Print It
PDF
No ratings yet
NPC - Print It
22 pages
Adsa QB
PDF
No ratings yet
Adsa QB
5 pages
Daa Aat2 Plag
PDF
No ratings yet
Daa Aat2 Plag
5 pages
Daa Notes (Final)
PDF
No ratings yet
Daa Notes (Final)
41 pages
Intractable Problems: Part One
PDF
No ratings yet
Intractable Problems: Part One
29 pages
Daa PR10 123
PDF
No ratings yet
Daa PR10 123
19 pages
Copy of Quick Notes
PDF
No ratings yet
Copy of Quick Notes
14 pages
Intractable Problems: Part One
PDF
No ratings yet
Intractable Problems: Part One
29 pages
Lecture 19: Dynamic Programming I: Memoization, Fibonacci, Shortest Paths, Guessing
PDF
No ratings yet
Lecture 19: Dynamic Programming I: Memoization, Fibonacci, Shortest Paths, Guessing
6 pages
N_Unit-3_DAA_B22EF0401_2023-24_IV
PDF
No ratings yet
N_Unit-3_DAA_B22EF0401_2023-24_IV
18 pages
Checkpoint_Week_1
PDF
No ratings yet
Checkpoint_Week_1
10 pages
daacheat
PDF
No ratings yet
daacheat
4 pages
lec09-dp1
PDF
No ratings yet
lec09-dp1
9 pages
N_Unit-4_DAA_B22EF0401_2023-24_IV
PDF
No ratings yet
N_Unit-4_DAA_B22EF0401_2023-24_IV
8 pages
Module 5
PDF
No ratings yet
Module 5
24 pages
Intro To Dynamic Programming
PDF
No ratings yet
Intro To Dynamic Programming
7 pages
CSCI570 - Fall2024 HW3 Sep29
PDF
No ratings yet
CSCI570 - Fall2024 HW3 Sep29
4 pages
DOC-20241202-WA0004.
PDF
No ratings yet
DOC-20241202-WA0004.
6 pages
Dynamic Programming
PDF
No ratings yet
Dynamic Programming
7 pages
Dynamic programming
PDF
No ratings yet
Dynamic programming
8 pages
Week 7 & 11 - Dynamic Programming Strategy
PDF
No ratings yet
Week 7 & 11 - Dynamic Programming Strategy
58 pages
CS502 - Fundamental of Algorithm Short-Question Answer: Ref: Handouts Page No. 40
PDF
No ratings yet
CS502 - Fundamental of Algorithm Short-Question Answer: Ref: Handouts Page No. 40
8 pages
Dynamic Programming
PDF
No ratings yet
Dynamic Programming
46 pages
Simran(2425576),MCA-2nd Sem, 3rd Assignment of DAA
PDF
No ratings yet
Simran(2425576),MCA-2nd Sem, 3rd Assignment of DAA
14 pages
6.006 Introduction To Algorithms: Mit Opencourseware
PDF
No ratings yet
6.006 Introduction To Algorithms: Mit Opencourseware
5 pages
Mari Belajar Backtracking
PDF
No ratings yet
Mari Belajar Backtracking
59 pages
NP-Compl
PDF
No ratings yet
NP-Compl
21 pages
Daa 5 Marks Answers
PDF
No ratings yet
Daa 5 Marks Answers
8 pages
CS502 Solved Subjective For Final Term
PDF
No ratings yet
CS502 Solved Subjective For Final Term
19 pages
Dynamic Programming. 1: CS 3510 - Design and Analysis of Algorithms
PDF
No ratings yet
Dynamic Programming. 1: CS 3510 - Design and Analysis of Algorithms
8 pages
Unit 5
PDF
No ratings yet
Unit 5
16 pages
Computer Science An Overview 12th Edition Brookshear Solutions Manual 1
PDF
100% (68)
Computer Science An Overview 12th Edition Brookshear Solutions Manual 1
36 pages