FUNDAMENTALS OF COMPUTERS AND
COMPUTATIONALTHINKING
Module 4
Computer Science and Computational Thinking
Topic: Algorithmic Thinking
06/11/2024 Mrs. Abida.T
Head & Asst Prof.
Department of Computer Science
Intuition
• It is the ability to comprehend something
immediately, without the need for explicit
definitions or analyses.
• It operates in some high-dimensional space
that provides the genuine meaning of a
situation.
Precision
• It specify precisely the sequence of steps to be
performed including how to handle errors.
Algorithm
• A sequence of finite steps to solve a particular
problem.
Use of Algorithms
• Algorithms play a crucial role in various fields
and have many applications.
– Computer Science:
• Algorithms form the basis of computer programming and
are used to solve problems ranging from simple sorting
and searching to complex tasks such as artificial
intelligence and machine learning.
– Mathematics:
• Algorithms are used to solve mathematical problems,
such as finding the optimal solution to a system of linear
equations or finding the shortest path in a graph.
Use of Algorithms
• Operations Research:
– Algorithms are used to optimize and make decisions in fields
such as transportation, logistics, and resource allocation.
• Artificial Intelligence:
– Algorithms are the foundation of artificial intelligence and
machine learning, and are used to develop intelligent systems
that can perform tasks such as image recognition, natural
language processing, and decision-making.
• Data Science:
– Algorithms are used to analyze, process, and extract insights
from large amounts of data in fields such as marketing, finance,
and healthcare.
Need of Algorithms
• Algorithms are necessary for solving complex
problems efficiently and effectively.
• They help to automate processes and make them
more reliable, faster, and easier to perform.
• They enable computers to perform tasks that would
be difficult or impossible for humans to do manually.
• They are used in various fields such as mathematics,
computer science, engineering, finance, and many
others to optimize processes, analyze data, make
predictions, and provide solutions to problems.
Characteristics of a good Algorithm
• Clear and Unambiguous:
– The algorithm should be unambiguous.
– Each of its steps should be clear in all aspects and must
lead to only one meaning.
• Well-Defined Inputs:
– If an algorithm says to take inputs, it should be well-
defined inputs.
– It may or may not take input.
• Well-Defined Outputs:
– The algorithm must clearly define what output will be
yielded and it should be well-defined as well.
– It should produce at least 1 output.
Characteristics of a good Algorithm
• Finiteness:
– The algorithm must be finite, i.e. it should terminate
after a finite time.
• Feasible:
– The algorithm must be simple, generic, and practical,
such that it can be executed with the available
resources.
• Language Independent:
– The Algorithm designed must be language-
independent, i.e. it must be just plain instructions that
can be implemented in any language, and yet the
output will be the same, as expected.
Characteristics of a good Algorithm
• Input:
– An algorithm has zero or more inputs.
• Output:
– An algorithm produces at least one output
• Definiteness:
– All instructions in an algorithm must be unambiguous, precise, and
easy to interpret.
– By referring to any of the instructions in an algorithm one can clearly
understand what is to be done.
• Effectiveness:
– An algorithm must be developed by using very basic, simple, and
feasible operations so that one can trace it out by using just paper and
pencil.
Qualities of a good algorithm
• Efficiency:
– A good algorithm should use minimal resources and
perform its task quickly.
• Correctness:
– It should produce the correct output for all valid inputs.
• Clarity:
– It should be easy to understand and modify.
• Scalability:
– It should be able to handle larger data sets and problem
sizes without a significant decrease in performance.
Qualities of a good algorithm
• Reliability:
– It should consistently deliver correct results under
different conditions and environments.
• Robustness:
– It should be able to handle unexpected inputs or errors
gracefully without crashing.
• Adaptability:
– It can be applied to a range of related problems with
minimal adjustments.
Qualities of a good algorithm
• Simplicity:
– It should be as simple as possible while meeting its
requirements.
• Well-defined steps:
– It should have specific, outlined steps that are exact
enough to precisely specify what to do at each step.
• Reproducibility:
– It should produce the same output for a given set of
inputs consistently.
Advantages of Algorithms
• It is easy to understand.
• It is a step-wise representation of a solution to
a given problem.
• In an Algorithm the problem is broken down
into smaller pieces or steps hence, it is easier
for the programmer to convert it into an
actual program.
Disadvantages of Algorithms
• Writing an algorithm takes a long time so it is
time-consuming.
• Understanding complex logic through
algorithms can be very difficult.
• Branching and Looping statements are difficult
to show in Algorithms.
An algorithm to add two numbers:
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the
result to sum.
sum←num1+num2
Step 5: Display sum
Step 6: Stop
Find the largest number among three
numbers
Step 1: Start
Step 2: Declare variables a,b and c.
Step 3: Read variables a,b and c.
Step 4: If a > b
If a > c
Display a is the largest number. Else
Display c is the largest number.
Else
If b > c
Display b is the largest number.
Else
Display c is the largest number.
Step 5: Stop
Flowchart
• It is a type of diagram that represents a
workflow or process.
• A diagrammatic representation of an
algorithm, a step-by-step approach to solving
a task.
Flowchart symbols
• Different types of boxes are used to make
flowchart Symbols.
• All the different kinds of boxes are connected
by arrow lines.
• Arrow lines are used to display the flow of
control
Symbol Name Symbol Representation
Terminal/Terminator
Process
Decision
Symbol Name Symbol Representation
Predefined process
On-page
connector/reference
Off-page
connector/reference
Symbol Name Symbol Representation
Data or Input/Output
Stored Data
Flow Arrow
Thank You