Posts

The Coin Change Problem | Dynamic Programming vs. Greedy Approach

Greedy fails. DP wins. Here's why. Lecture link: https://www.youtube.com/watch?v=Xu5iBfS0M6I In this video, we solve the Coin Change Problem — one of the most important problems in computer science. We first show how the greedy approach (always pick the biggest coin) gives the WRONG answer, then build the Dynamic Programming solution step by step from scratch. 📌 What you'll learn: → Why greedy breaks on certain coin sets → The DP recurrence: dp[i] = min(dp[i], dp[i - coin] + 1) → How to fill the DP table manually, one cell at a time → Time & space complexity analysis 🔔 Subscribe to follow the full Optimization Problems series! #dynamicprogramming #CoinChange #algorithms #problemsolving #codinginterview #computerscience #programming #greedyalgorithm #leetcode

Fractional Knapsack Problem Example Solution — Greedy Algorithm for Maximum Profit

Lecture Link In this lecture, we apply the Fractional Knapsack Algorithm to a real-world scenario — a store owner trying to display the most profitable fruits on a limited-weight table. 🏪🍎 You’ll learn how the greedy method works, why it’s optimal for divisible items, and how to calculate the maximum total value using value per kilogram. We’ll go through the full reasoning: 1-Defining the problem and scenario 2-Computing value densities for each fruit 3-Filling the 30 kg capacity step by step 4-Showing exactly how much of each fruit to take 5-Calculating the final maximum profit = $222 This example will help you understand how greedy algorithms make optimal decisions for fractional knapsack problems and how to reason through each step manually.

Fractional Knapsack Explained — Greedy Algorithm Step-by-Step

Lecture Link In this lecture, we introduce the Fractional Knapsack Problem, one of the most important applications of the Greedy Algorithm in optimization. You’ll learn why we use it, where it applies in the real world, and how to design the algorithm step by step. We’ll walk through the intuitive idea behind value-per-weight (density), explore practical examples like resource allocation and profit maximization, and write the pseudoalgorithm you’ll use to solve problems in the next lecture.

Regular Expressions with Examples

Lecture Link In this video, we break down regular expressions (regex) step by step — from the basic building blocks to how they form regular languages. You’ll learn: 1- The three core operations: Concatenation, Union, and Kleene Star 2- The difference between the empty string (ε) and the empty set (∅) 3- The distinction between Kleene Star (★) and the plus (+) operator 4- How regex compares to arithmetic operations with simple analogies 5- Solved examples to help you actually use these operations By the end, you’ll understand how regular expressions are built, how they define regular languages, and why they’re such a powerful tool in computer science. If you’re a student, developer, or just curious about how search patterns and compilers work, this video is for you!

Fractional Knapsack Greedy Algorithm Explained | Use Cases, and Step-by-Step Algorithm

  Lecture Link In this lecture, we introduce the Fractional Knapsack Problem, one of the most important applications of the Greedy Algorithm in optimization. You’ll learn why we use it, where it applies in the real world, and how to design the algorithm step by step. We’ll walk through the intuitive idea behind value-per-weight (density), explore practical examples like resource allocation and profit maximization, and write the pseudoalgorithm you’ll use to solve problems in the next lecture. ⚡️ In the next video, we’ll solve full examples step by step, so make sure you watch this one first to master the concept!

Knapsack Problem in Python | Dynamic Programming Algorithm + Backtracking Explained Step by Step

  Lecture Link In this video, we’ll write and explain the 0/1 Knapsack algorithm in Python line by line. You’ll learn how to: 1- Build a Dynamic Programming (DP) table to find the maximum profit 2- Understand each part of the nested loops that fill the table 3- Implement the backtrace function to recover the selected items 4- See how DP and backtracking work together in solving optimization problems

Dynamic Programming Example Solution — Knapsack Problem Solved Step by Step

Lecture Link In this video, we solve the 0/1 Knapsack Problem step by step using Dynamic Programming . We cover two essential parts of the solution: 1️⃣ Building the DP table — to find the maximum profit achievable without exceeding the knapsack’s capacity. 2️⃣ Backtracking the table — to trace which items were actually chosen to reach that maximum profit. By the end of the lecture, you’ll not only know the optimal profit but also exactly which items to select , making this one of the clearest walkthroughs of the knapsack problem you’ll find.