Yeh page exchange-argument note ka ground floor hai. Uss proof ki ek bhi line padhne se pehle, tumhe har woh symbol apna banana hoga jo woh tumpar fenkta hai. Hum har ek ko ek picture se build karte hain — koi bhi symbol yahan tab tak nahi aata jab tak tumne dekh nahi liya ki uska matlab kya hai.
Lagbhag har exchange proof ek scheduling ya choosing duniya mein rehta hai. Ek single machine socho — ek printer, ek CPU, ek busy insaan — jo ek waqt mein sirf ek task kar sakta hai. Tumhare paas jobs ka ek pile hai. Tumhe decide karna hai ki unhe kaunse order mein karo. Alag alag orders ka alag alag cost hota hai. Hum sabse sasta order chahte hain.
Ek greedy rule order decide karne ki ek simple recipe hai aage dekhe bina: har step pe, woh job chuno jo ek fixed criterion pe best score kare. Do greedy rules jo tumhe parent note mein milenge:
Shortest-Job-First (SPT): hamesha abhi tak na kiya gaya sabse chhota job pehle chalao.
Smallest-ratio-first (Smith's rule): hamesha woh job chalao jiska pk/wk sabse chhota ho (yeh tab use hota hai jab jobs ke importance weights hon — §4 dekho).
Neeche sab kuch uss picture ke baare mein precisely baat karne ki vocabulary hai.
Plain words:pk = "job number k ko kitna waqt lagta hai."
Picture: Figure 1 mein har job ek coloured bar hai; bar ki widthpk hai. Chauda bar = lamba job.
Yeh kyun chahiye: poora game jobs ko order karne ke baare mein hai, aur cost is baat pe depend karta hai ki har ek kitna lamba hai. Lengths ke bina optimise karne ke liye kuch nahi hai.
p ke neeche latka chhota k ek subscript hai — yeh multiplication nahi hai. pk ko "p-sub-k" padha jaata hai aur iska matlab sirf hai "job k ka p." Toh p3 job 3 ki length hai.
Yeh kyun chahiye: woh cost jo hum minimise karte hain woh inhiin finish-times se bani hai. Yeh woh number hai jis baare mein poora topic sochta hai.
Picture ka key insight: kisi job ka completion time usse pehle ya uske order mein barabar aane wali har job ki lengths ka sum hota hai. Agar order hai job A (length 3), phir job B (length 2), toh:
CA=3,CB=3+2=5.
Job B ko A ke finish hone ka wait karna pada — woh waiting CB mein baka hai. Isi liye order matter karta hai.
Plain words:∑k=1nCk=C1+C2+C3+⋯+Cn — har job ke liye ek term, koi job chhoot nahi.
Picture: har job ki finish-time ko stack karo aur heights total karo.
Yeh kyun chahiye: humara objective — woh cheez jo hum minimise karte hain — hai total completion time∑k=1nCk. Yeh jobs ko jaldi finish karne ko reward karta hai, kyunki jaldi finish karna ek chhota number hai jo pile mein add hota hai.
Picture: sunset figure mein, socho har bar ki ek brightness bhi hai — brighter = zyada important = zyada weight.
Yeh kyun chahiye: general objective hai weighted total ∑k=1nwkCk: ek important job late finish hona bahut cost karta hai, ek unimportant ek late finish hona thoda cost karta hai. Jab sab wk=1 hote hain toh yeh wapas plain ∑k=1nCk ban jaata hai.
Parent note ke mistake-box mein ratio wkpk ("length divided by importance") use hota hai. Chhota ratio = chhota aur important = pehle karo. Yeh Smith's rule hai (dekho Smith's rule — weighted completion time).
Plain words:n = "kitne jobs hain"; G = "greedy kya karta hai"; O = "ek true champion answer." Dono lists mein exactly wohi n jobs hain — sirf order differ karta hai.
Picture: unhi coloured bars ki do rows, possibly alag left-to-right orders mein.
Yeh kyun chahiye: poora proof in do lists ko position by position compare karta hai. Parentheses (g1,…,gn) sirf ek ordered list hai — g1 pehli cheez hai jo ki jaati hai, gn aakhri. Subscript ek position hai, koi job number nahi.
Picture: neeche — do bars pakdo, arrows cross karo, har ek ko dusre ki jagah rakho.
Yeh kyun chahiye: proof baar baar inversions ko swapping karke remove karta hai. Har swap O aur G ke beech ek disagreement fix karta hai.
Kyunki sirf swapped pair move karta hai, sirf unki completion times change hoti hain — har doosra job same clock time pe start aur end hota hai. Isi se cost change compute karna easy ho jaata hai (sirf do terms).
Plain words: woh sabse pehla spot dhundho jahaan dono lists differ karti hain; greedy ki choice ko O mein jahaan bhi chhupa ho wahan se upar uss spot pe le aao.
Yeh kyun first difference: taki pehle se match karne wala hissa matched rahe. Isse hum steadily G ki taraf progress karte hain aur guarantee karte hain ki process ruk jayegi (finitely many disagreements, har swap ek ko khatam karta hai). Neeche Induction idea dekho.