3.1.8 · HinglishComplexity Analysis

Substitution method for recurrences

1,688 words8 min readRead in English

3.1.8 · Coding › Complexity Analysis


Yeh Hai Kya?

ASAL MEIN HUM KYA KAR RAHE HAIN: ek candidate bound chunna aur prove karna ki inductive invariant " for all " se "" force hota hai.


KAISE: recipe (first principles se derivation)

Hum formula kabhi seedha nahi dalunga. Yeh raha engine, step by step.

Maano .

  1. Guess karo — ise inductive hypothesis (IH) kaho.
  2. Maano IH sab chhote values ke liye sahi hai, khaaskar ke liye: Yeh step kyun? Induction hume allow karta hai ki se chhote inputs ke liye claim assume karo; qualify karta hai.
  3. Substitute karo recurrence mein: Yeh step kyun? ko uske (assumed) upper bound se replace karna right side ko sirf badhata ya same rakhta hai — upper bound ke liye yeh legal hai.
  4. Massage karo right side ko tab tak jab tak woh na ho jaaye. Baaki bache terms ko absorb karna hoga. Agar tum aisa chun sako ki residual ho jaaye, tum jeet gaye.
  5. Base case: chhote check karo (jaise ) taaki induction grounded rahe.


Worked Example 1 —


Worked Example 2 — subtle constant trap


Worked Example 3 — subtract-a-lower-order-term trick




Recall Feynman: ek 12-saal ke bachche ko explain karo

Socho ek magic box hai jo, ek badi question ka jawab dene ke liye, khud ke do chhote copies se poochh ta hai aur thoda apna kaam bhi karta hai. Tum jaanna chahte ho poori cheez kitna time leti hai. Tum ek smart guess karte ho ("mujhe lagta hai isme seconds lagenge"). Phir ek game khelate ho: maano chhote boxes already tumhari guess maante hain, use plug in karo, aur check karo ki bada box abhi bhi ise maanta hai ya nahi. Agar baaki kaam gayab ho jaaye (zero ya negative ho jaaye), tumhara guess sahi tha! Agar koi zidd piece nahi jaata, tumhara guess galat tha aur tum ek bada try karte ho. Tum sabse chhota box hath se bhi check karte ho taaki "maano" ka poora chain solid ground par khara rahe.


Active Recall

Substitution method ke do steps kya hain?
(1) Solution ki form guess karo; (2) induction se prove karo, constants dhundho.
Method ka naam "substitution" kyun hai?
Kyunki hum inductive hypothesis (chhote inputs ke liye guess) ko wapas recurrence mein substitute karte hain bound verify karne ke liye.
prove karte waqt residual/leftover terms ka kya hona chahiye?
Woh ek akele fixed constant ke liye honni chahiye (yaani poori tarah absorb ho jaayein).
ke liye tight bound kya hai aur kyun nahi hai?
; assume karne se milta hai, extra jo koi bhi fixed absorb nahi kar sakta.
Inductive step ke dauran constant se kyun nahi badh sakta?
Induction ko WAHI reproduce karna hota hai; per-level growth levels mein accumulate ho jaati hai aur bound bigad jaati hai.
"Strengthen the hypothesis" trick kya hai?
Guess karo (ek lower-order term subtract karo) taaki slack mile jo zidd residuals absorb kare.
Base case check karna kyun zaroori hai?
Induction ko ground kiye bina koi bhi galat claim "prove" ki ja sakti hai; saath hi yeh chhote ke liye fix karta hai.
bound ke liye ki jagah kyun chunte hain?
se ho jaata hai par, jo positive ko bound nahi kar sakta.

Connections

Concept Map

has shape induction loves

enables

first do

then do

relies on

applied to smaller input

plug into recurrence

simplify

choose c so residual le 0

grounded by

verified in

needs n0 = 2

Recurrence T of n hides runtime

Proof by induction

Substitution method

Step 1 Guess closed form

Step 2 Prove by induction

Inductive hypothesis T of k le c f k

Assume IH for n over b

Substitute into recurrence

Massage right side

Absorb residual le 0

Base case at n0

Example 2T of n over 2 plus n = O of n log n