Skip to main content
Advanced Search
Search Terms
Content Type

Exact Matches
Tag Searches
Date Options
Updated after
Updated before
Created after
Created before

Search Results

297 total results found

2. Compile-Time Polymorphism

Alprog - Elektro KKI Module 10 : OOP - Polymorphism

2.1 Function Overloading Definition: Multiple functions with the same name but different parameters. #include <iostream> #include <string> using namespace std; class Printer { public: // Overloaded print functions void print(int value) { cout ...

3. Runtime Polymorphism

Alprog - Elektro KKI Module 10 : OOP - Polymorphism

3.1 Virtual Functions Definition: Functions that can be overridden in derived classes and are resolved at runtime. #include <iostream> #include <string> using namespace std; class Animal { protected: string name; public: Animal(string n) : name(n...

4. Practical Applications

Alprog - Elektro KKI Module 10 : OOP - Polymorphism

4.1 Complete Example: Drawing Application #include <iostream> #include <vector> #include <string> #include <cmath> using namespace std; // Abstract base class class Shape { protected: string color; double x, y; // Position public: Shape(stri...

1. Introduction to DP

Algorithm Programming Module 10 - Dynamic Programming

What is DP? Dynamic programming (DP) is defined as a powerful design technique that successfully combines the correctness of brute force algorithms with the efficiency of greedy algorithms. The fundamental idea of dynamic programming is to remember the solutio...

Code & Examples 1

Algorithm Programming Module 10 - Dynamic Programming

DP for Fibonacci Problem To illustrate Dynamic Programming, let's look at the classic Fibonacci Sequence. The rule is simple: each number is the sum of the two preceding ones ($F(n) = F(n-1) + F(n-2)$), starting with 0 and 1. 1. The Original Solution (Naive Re...

Code & Examples 2

Algorithm Programming Module 10 - Dynamic Programming

Knapsack Problem Given n items where each item has some weight and profit associated with it and also given a bag with capacity W, [i.e., the bag can hold at most W weight in it]. The task is to put the items into the bag such that the sum of profits associate...