Mangalayatan University
JAN’2025 SESSION
Faculty Name :- Prof. LALIT MOHAN GUPTA
Course Name :- Programming with ‘C’
Course Code :- CSM – 6115
Semester :- 1
Class No. :- 1
Chapter No :-1,2,3
Sunday, September 21, 2025 Mangalayatan University
Mangalayatan University
Block I: Algorithmic Process & Basic of ‘C’ Programming
Unit–1: Algorithms, General Approaches & Analysis,
Program and Programming Language.
Unit–2: Fundamental Stages of Problem Solving,
Feature of Programming Language, Flow Charts.
Unit–3: Learning outcomes, Program and Programming
Language, Introduction to C Language, Programming
Format of C.
Unit–4: Creating a C Program, Compilation process in C
Program, Link and Running C Program, Diagrammatic
Illustration.
Sunday, September 21, 2025 Mangalayatan University
Mangalayatan University
Introduction to Algorithms
• Definition: An algorithm is a finite set of instructions
designed to perform a specific task.
• Purpose: Solving problems, performing computations,
processing data.
• Examples: Sorting algorithms, search algorithms,
cryptographic algorithms
Sunday, September 21, 2025 Mangalayatan University
Mangalayatan University
Characteristics of a Good Algorithm
Speed - A computer is a fast device. A powerful computer is capable
of performing several billions of arithmetic operations per second.
Accuracy - Computers are accurate and depends upon its design.
Diligence - It is free from monotony, tiredness and lack of
concentration.
Versatility - A computer is capable of performing almost any task, if
the table can be reduced to a series of logical steps.
Storage - A computer can store and recall any amount of information
because of its secondary storage capability.
Automation - It works on a problem without any human intervention.
Once it started on a job, they carry on, until the job is finished.
Sunday, September 21, 2025 Mangalayatan University
Mangalayatan University
Characteristics of a Good Algorithm
• Correctness: Produces the correct output for all inputs.
• Efficiency: Minimizes resource usage (time, memory).
• Simplicity: Easy to understand and implement.
• Generality: Can handle a wide range of inputs
• Finiteness: Must terminate after a finite number of steps.
• Definiteness: Each step must be clearly and unambiguously
defined.
• Input: Zero or more inputs are externally supplied.
• Output: At least one output is produced.
• Effectiveness: All operations must be basic enough to be
performed in a finite amount of time.
Sunday, September 21, 2025 Mangalayatan University
Mangalayatan University
General Approaches to Algorithms
• Divide and Conquer: Break the problem into smaller subproblems, solve
each one, and combine results.
• Examples: Merge Sort, Quick Sort
• Dynamic Programming: Solve complex problems by breaking them into
simpler overlapping subproblems and storing solutions.
• Examples: Fibonacci sequence, Knapsack problem
• Greedy Algorithms: Make a series of choices that seem best at the moment.
• Examples: Dijkstra’s algorithm, Prim's algorithm
• Backtracking: Explore all possible solutions by building a solution
incrementally and removing solutions that fail to satisfy constraints.
• Examples: N-Queens problem, Sudoku solver
• Brute Force: Try all possible solutions to find the best one.
• Examples: Traveling Salesman Problem
Sunday, September 21, 2025 Mangalayatan University
Mangalayatan University
Algorithm Analysis
• Time Complexity: Measures the time an algorithm takes
relative to its input size.
• Big O Notation (e.g., O(n), O(log n), O(n^2))
• Space Complexity: Measures the amount of memory an
algorithm needs.
• Trade-offs: Balancing time vs. space complexity.
• Best, Average, and Worst Case Analysis: Understanding
algorithm performance in different scenarios.
Sunday, September 21, 2025 Mangalayatan University
Mangalayatan University
Program vs. Algorithm
• Algorithm: A step-by-step procedure or formula for
solving a problem.
• Program: A set of instructions written in a programming
language to implement an algorithm.
• Example: Pseudocode for an algorithm vs. code in
Python.
Sunday, September 21, 2025 Mangalayatan University
Mangalayatan University
Programming Languages Overview
• Definition: A formal language comprising a set of
instructions used to produce various kinds of output.
• Types of Programming Languages:
• Low-level: Machine language, Assembly language
• High-level: Python, Java, C++, JavaScript
• Choosing a Programming Language: Based on factors
like performance, development speed, readability,
community support.
Sunday, September 21, 2025 Mangalayatan University