What Is an Algorithm?
An algorithm is a step-by-step set of instructions designed to perform a specific task or solve a
problem.
In computer science, algorithms tell the computer exactly what steps to follow to complete a job.
> Example: A cooking recipe is like an algorithm-it tells you the steps to make a meal.
Key Features of Algorithms
1. Input - Data the algorithm works on
2. Output - The result after processing
3. Definiteness - Every step is clearly defined
4. Finiteness - The algorithm ends after a number of steps
5. Effectiveness - All steps are doable
Example of a Simple Algorithm
Problem: Add two numbers
Steps:
1. Start
2. Enter first number
3. Enter second number
4. Add the numbers
,5. Display the result
6. End
Why Are Algorithms Important?
- They help solve problems faster
- Used in search engines, apps, games, banking systems, and more
- Form the backbone of coding and AI
Practice Questions
1. Define an algorithm in your own words.
2. List three features of a good algorithm.
3. Create an algorithm to find the largest of two numbers.
4. Why must an algorithm be finite?
5. What is the output in this algorithm:
Step 1: Start
Step 2: Input number A = 7
Step 3: Multiply A by 2
Step 4: Output result
Step 5: End
Answer Key
1. A set of instructions to solve a problem or complete a task.
2. Input, Output, Finiteness (others: Definiteness, Effectiveness).
3. Step 1: Start
, Step 2: Enter two numbers A and B
Step 3: If A > B, display A
Step 4: Else, display B
Step 5: End
4. So the algorithm doesn't run forever-it must finish.
5. Output: 14
, CONTENTS
MODULE – I
Lecture 1 - Introduction to Design and analysis of algorithms
Lecture 2 - Growth of Functions ( Asymptotic notations)
Lecture 3 - Recurrences, Solution of Recurrences by substitution
Lecture 4 - Recursion tree method
Lecture 5 - Master Method
Lecture 6 - Worst case analysis of merge sort, quick sort and binary search
Lecture 7 - Design and analysis of Divide and Conquer Algorithms
Lecture 8 - Heaps and Heap sort
Lecture 9 - Priority Queue
Lecture 10 - Lower Bounds for Sorting
MODULE -II
Lecture 11 - Dynamic Programming algorithms
Lecture 12 - Matrix Chain Multiplication
Lecture 13 - Elements of Dynamic Programming
Lecture 14 - Longest Common Subsequence
Lecture 15 - Greedy Algorithms
Lecture 16 - Activity Selection Problem
Lecture 17 - Elements of Greedy Strategy
Lecture 18 - Knapsack Problem
Lecture 19 - Fractional Knapsack Problem
Lecture 20 - Huffman Codes
MODULE - III
Lecture 21 - Data Structure for Disjoint Sets
Lecture 22 - Disjoint Set Operations, Linked list Representation
Lecture 23 - Disjoint Forests
Lecture 24 - Graph Algorithm - BFS and DFS
Lecture 25 - Minimum Spanning Trees
Lecture 26 - Kruskal algorithm
Lecture 27 - Prim's Algorithm
Lecture 28 - Single Source Shortest paths
Lecture 29 - Bellmen Ford Algorithm
Lecture 30 - Dijkstra's Algorithm
MODULE -IV
Lecture 31 - Fast Fourier Transform
Lecture 32 - String matching
Lecture 33 - Rabin-Karp Algorithm
Lecture 34 - NP-Completeness
Lecture 35 - Polynomial time verification
Lecture 36 - Reducibility
Lecture 37 - NP-Complete Problems (without proofs)
Lecture 38 - Approximation Algorithms
Lecture 39 - Traveling Salesman Problem