0% found this document useful (0 votes)
41 views25 pages

3 Algorithm

Uploaded by

mama8967937126
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views25 pages

3 Algorithm

Uploaded by

mama8967937126
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Academic Session 2025-26

ODD Semester Jul-Dec 2025

INSTITUTE - UIE
Department of Engineering Foundations
Bachelor of Engineering (Computer Science & Engineering)
Subject Name: Logical Thinking & Problem Solving
Code:25CSH-107

Unit No. 1 Chapter No. 1 Lecture No.3

Topic : Hands on session on Flowcharts

Faculty Name-Dr. Sheenam

E_Code - E6717

Designation-Assistant Professor
Logical Thinking
& Problem
Solving

Course Objectives
The course aims to provide a strong foundation
in problem-solving using the C programming
language.
It enhances students' programming skills by
developing logical thinking and algorithmic
problem-solving abilities
By mastering C programming concepts, students
will be able to design and implement efficient
solutions for real-world problems
2
Course Outcomes
CO No Statement

To remember the concepts related to


CO1 fundamentals of C language, Algorithm/
pseudocode, Flowcharts and Problem solving
To understand the way of execution and debug
CO2
programs in C language.

To apply various constructs, loops, functions to


CO3
solve mathematical and scientific problem.

To analyse the dynamic behaviour of memory


CO4
by the use of pointers.
To design and develop modular programs for
CO5 real world problems using control structure and
selection structure.

3
Scheme of Evaluation
Frequency of Final Weightage
Direct Evaluation Weightage of actual
S. No. Assessment tool in Internal
Instruments conduct Task Assessment
Unit-1 Practical 15 Marks Code-Blocks & Dev
1
Evaluation C
15 Marks Hacker Rank
2 Unit-2 Practical
Evaluation
Unit-3 Practical 15 Marks Code Fix problems 3
Evaluation / Mini
3 Project
45

Lab MST 15 Marks for one Online GDB 1 per semester


4 MST compiler 15
External Exam 40 Marks Hacker Rank 1 per semester
5
40
6 Attendance NA NA NA NA

4
• Space for visual (size 24)

CONTENTS

• Algorithms

5
ALGORITHM
• An algorithm is a series of instructions for carrying out an operation or solving a
problem.
• It is important to write computer programs without any logical error to generate
the proper output, so it is recommended that the programmer prepare a rough
design to solve the problem by showing the steps involved in the program. This is
called algorithm.
• In simple words, an algorithm is a step by step procedure to describe the solution
of a particular problem.
• Let’s take a real-world example, a simple algorithm to make a coffee! So, what are
the steps involved in making a Tea? Let’s write down all the steps one by one.

6
Characteristics of Algorithm
Finiteness: Any algorithm should complete at one particular time and this is very
important for any algorithm otherwise your algorithm will go in infinite state and it
will not complete ever.
Definiteness: Each algorithm should be clear and unambiguous.
Effectiveness: Each line of an algorithm should be essentials. We should try to
write in a simple way so it would be basic.
Input: Every algorithm should take input it can be Zero or one or more. So
according to the conditions user can use.
Output: For any work some output should come, this is must otherwise there is no
meaning of any work. In the same way, each algorithm should generate one or
more output.
Generality: The algorithm should be common for the set of input and
requirements so the same algorithm can apply in multiple places according to the
user’s requirements.
7
ALGORITHM TO MAKE TEA
Step 1- Start
Step 2-Take a cup and tea bag
Step 3-Put the teabag in cup.
Step 4-Fill the kettle with water.
Step 5-Boil the water for few seconds
Step 6-Pour some of the boiled water into the cup.
Step 7-Add milk to the cup.
Step 8-Add required sugar to the cup.
Step 9- Stir the cup for few seconds and the tea is ready
Step 10- Stop
8
Example: Add Two Numbers
Step 1 Start
Step 2 Accept or Read number1
Inputs
Step 3 Accept or Read number2
Step 4 Add number1 and number2 and store the result in sum
Process
Sum=number1+number2
Step 5 Display sum
Step 6 Stop
Output

9
Example: Calculate area of Rectangle

STEP 1 : Start
STEP 2 : Read W of Rectangle
STEP 3 : Read h of Rectangle
STEP 4 : calculate area
Area = w × h
STEP 5 : Display Area
STEP 6 : Stop

10
CALCULATE INTEREST OF BANK
DEPOSIT
• Step 1: Start
• Step 2: Read Amount
• Step 3: Read Years
• Step 4: Read Rate
• Step 5: Calculate the interest with formula
Interest=Amount*Years*Rate/100
• Step 6: Display interest

11
DETERMINE WHETHER STUDENT
PASSED THE EXAM OR
NOT
• Step 1: Start
• Step 2: Read grades of 4 courses M1, M2, M3 and M4,
• Step 3: Calculate the average grade with formula
"Grade=(M1+M2+M3+M4)/4"
Step 4: If the average grade is less than 60, Display "FAIL", else Display
"PASS".
Step 5: Exit

12
DETERMINE WHETHER THE NUMBER
IS EVEN OR ODD
• Step 2: Read Number N,
• Step 3: Set remainder = N modulo 2,
• Step 4: If remainder is equal to 0 then Goto step 5 else Goto step 6
Step 5: Display Number N is even
Step 6: Display Number N is odd.
• Step 7: Stop

13
Display your name ( 1 time &
100 times)
Step 1: Start
Step 1: Start
Step 2: Set counter=1
Step 2: Display “Aman” Repetition of
Step 3: Repeat steps 4 and 5 until
Step 3: Stop counter<=100
statements(Loop)

Step 4: display “Aman”


Step 5: increase counter by 1
Counter=counter+1
Step 6:Stop

14
Advantages of Algorithm
•The algorithms are very easy to understand and can be written in simple language
which can be understood by anyone
•Algorithms can be broken down into different pieces, which will be easy to implement
practically.
•By using algorithms, we can easily understand the sequence to be followed in
processing.

Disadvantages of Algorithm
Below are some main disadvantages of any algorithms:
•It’s very difficult to convert the complex task into proper algorithms.
•Its time-consuming process because we need to spend proper time for writing
algorithm and later we need to implement in a programming language.
•It’s complicated to show functionalities for each step of introduction to algorithms and
it’s hard to understand each flow in the term for loop and branch.

15
Summary

In this lecture we have We have discussed about c


discussed about programming programming language ,
languages, need of covered some features of C and
programming language. language translators.

Moreover we have learnt


about algorithms , need of Discussed about advantages ,
algorithms in programming disadvantages and applications
and we have designed some of algorithm
algorithms
16
Frequently Asked question
Q1 Where are algorithms used in real life?
Answer: In real life these algorithms are used in mp3 players, video players, making
dictionaries and there are much examples for searching and sorting.
Searching Algorithms is used in Quantum computing also. In Operating system
scheduling of tasks is done through various algorithms such as FIFO, Round robin, etc.
Google when showing search results uses page ranking techniques. Facebook when
showing news feed uses a similar ranking algorithm to make it more relevant to you.
All these use a modification of Link Analysis, an interesting branch in Data Mining.
So, whenever you press a key on your keyboard, make a call, perform a calculation,
start an application or press a remote button, always an algorithms is triggered. So,
there are countless examples of many algorithms in our daily life and making our life
easier.
17
Q2 What are the various types of algorithms?
Answer: There are numerous types of algorithms designed to a particular
purpose.
• Recursive algorithms.
• Dynamic programming algorithm.
• Backtracking algorithm.
• Divide and conquer algorithm.
• Greedy algorithm.
• Brute Force algorithm.
• Randomized algorithm.
• Facial recognition algorithms
• Shortest Path Finding Algorithm
18
Q3 Write an algorithm to find maximum of three numbers.
Answer: Algorithm:
Step 1 : Start
Start 2 : Input a, b, c
Start 3 : if a > b goto step 4, otherwise goto step 5
Start 4 : if a > c goto step 6, otherwise goto step 8
Start 5 : if b > c goto step 7, otherwise goto step 8
Start 6 : Output "a is the largest", goto step 9
Start 7 : Output "b is the largest", goto step 9
Start 8 : Output " c is the largest", goto step 9
Start 9 : Stop
19
Assessment Questions:
1. The word ____________comes from the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa
al Khowarizmi.
a) Flowchart
b) Flow
c) Algorithm
d) Syntax

2. In computer science, algorithm refers to a special method usable by a computer for the solution to a problem.
a) True
b) False

3. This characteristic often draws the line between what is feasible and what is impossible.
a) Performance
b) System Evaluation
c) Modularity
d) Reliability

20
4. Which of the following is incorrect? Algorithms can be represented:
a) as pseudo codes
b) as syntax
c) as programs
d) as flowcharts

5. When an algorithm is written in the form of a programming language, it becomes a _________


a) Flowchart
b) Program
c) Pseudo code
d) Syntax

6. Any algorithm is a program.


a) True
b) False

7 Design an algorithm to calculate percentage of a student for marks of 5 subjects.


8 Design an algorithm to check the given number is positive negative or zero
9 Design an algorithm to find maximum among 4 numbers
10 design an algorithm to check whether a person is eligible for vote or not.
11. Differentiate Middle level and high level language .
21
Discussion forum.
Real life applications of algorithms, students please have a look at this
video and mention your views , also add some new examples

https://www.youtube.com/watch?v=CvSOaYi89B4

22
REFERENCES
Reference Books:
[1] Programming in C by Reema Thareja.
[2] Programming in ANSI C by E. Balaguruswamy, Tata McGraw Hill.
[3] Programming with C (Schaum's Outline Series) by Byron Gottfried Jitender Chhabra, Tata McGraw Hill.
[4] The C Programming Language by Brian W. Kernighan, Dennis Ritchie, Pearson education.

Websites:
https://en.wikipedia.org/wiki/Algorithm
https://fiftyexamples.readthedocs.io/en/latest/algorithms.html
https://study.com/academy/lesson/what-is-an-algorithm-definition-exampl
es.html
YouTube Links:
What is an algorithm? https://youtu.be/6hfOvs8pY1k
23
Characteristics of algorithm. https://youtu.be/FbYzBWdhMb0
Class-wise feedback

24
THANK YOU

You might also like