📘 PAPER 4 – DESIGN & ANALYSIS OF ALGORITHMS ( UNIT 5 – RANDOMIZED ALGORITHMS & NP-COMPLETENESS) university of allahabad)
🔴 UNIT 5 – RANDOMIZED ALGORITHMS & NP-COMPLETENESS 🟦 PART A: RANDOMIZED ALGORITHMS 1️⃣ Randomized Algorithm ✅ Definition A Randomized Algorithm uses random numbers to make decisions during execution. 👉 Output or running time may vary for the same input. 🔹 Types of Randomized Algorithms 1️⃣ Las Vegas Algorithm ✔ Always gives correct result ✔ Execution time varies 📌 Example: Randomized Quick Sort 2️⃣ Monte Carlo Algorithm ✔ Fast execution ❌ May give incorrect result (with small probability) 📌 Example: Primality testing 2️⃣ Randomized Quick Sort Idea: Randomly select pivot Partition array Recursively sort Time Complexity: Case Time Best O(n log n) Average O(n log n) Worst O(n²) ✔ Faster in practice than normal quicksort 3️⃣ Randomized Min-Cut Algorithm Proposed by: Karger’s Algorithm Purpose: Find minimum cut in an undirected graph. Working: Pick random edge Contract vertices Repeat until 2 vertices remain Count cro...