Algorithms by Ammar Mussab
Algorithms by Ammar Mussab
Algorithms by Ammar Mussab
By Ammar Mussab
What we are going to learn
Methods for
Intro to Algorithms expressing Algorithms
01 What do we mean when we 04 How can we express
say the word algorithms? algorithms?
Benefits Summary
03 The benefits of algorithms. 06 All of this might be a lot to
There are too many! take in at once so why not
review so we can get a better
understanding?
2
01 Introduction
Before there were computers, there were algorithms. But
now that there are computers, there are even more
algorithms, and algorithms lie at the heart of computing.
3
“Anyone, from the most clueless amateur
to the best cryptographer, can create an
algorithm that he himself can't break."
-Bruce Schneier
4
WHAT MAKES A GOOD ALGORITHM ?
• Selection Sort
• Insertion Sort
• Merge Sort 5
Properties of algorithms
Non-Ambiguity Range of Input
The proper instruction in any algorithm should
not show any conflicting meaning. This The range of input should be specified. This is
property also indicates the effectiveness of because normally the algorithm is input driven and
the algorithm. That means each instruction if the range of input is not being specified then
should be direct and precise. Each Each key algorithm can go in an infinite state.
step in a developed algorithm should be non-
ambiguous.
Speed
The algorithm is carefully invented reliably using
Multiplicity some specified ideas. But such
The same algorithm can be represented into algorithms, should be efficient
several alternative and should produce the output with tremendous
ways. That means we can write in simple speed.
English the sequence of instruction, Finiteness
or we can note it in form of pseudo
code. Likewise, for solving the same problem, The algorithm should be finite. That means after
we can write several modified algorithms. performing required operations it
should terminate.
6
3 Benefits of Algorithms
Better problems solving: The identification of decision points and process divides the task into various
slighter steps that are more manageable. this means problems that would normally have been impossible
or difficult to resolve wholesale are going to be approached like a series of much smaller and
solvable problems.
Improving efficiency: Algorithms make decision making more consistent and more efficient. An
algorithm acts like a reminder device and assists in making sure that all variables or small parts of a
certain problem or task are not overlooked. Eventually, algorithms promote expertise development as it
facilitates the division of work amongst the employees.
Provides clarity
If a problem solver is not aware of what was performed, it is likely that she or he will not be aware of
what went wrong. The presence of a detailed solution process enables easier identification of errors and
weaknesses in the whole process. Reducing a vital task to several specified steps through using algorithm
provides clarity and it is a critical part of evaluation, control and analysis.
7
4 Methods of Expressing Algorithms
We can express an algorithm many ways, including natural language, flow charts,
pseudocode, and of course, actual programming languages.
Pseudocode. The pseudocode has an advantage of being easily converted into any
programming language.
8
5 Overview of Two Methods
1) Pseudocode
Pseudocode :Pseudocode is an artificial and informal language that helps programmers develop
algorithms. Pseudocode is a "text-based" detail (algorithmic) design tool. The direct rules of
Pseudocode are reasonably straightforward. All statements showing "dependency" are to be
indented. These include while, do, for, if and switch. Its essentially English with some defined
rules of structure and some keywords that make it appear a bit like program code.
Pseudocode is not actual programming language. It uses short phrases to write code for
programs
it can be quickly and easily converted into an actual programming language as it is similar to a
programming language.
9
6 2) Flowcharts
Elements of a flowchart:
The boxes are connected by directional arrows to show the flow of the solution.
Uses of a flowchart:
11
•
A M MA R M U SSA B
A M M A R . A L A Z I Z @ I R AQ I G G C . E D U. I Q
BASRA, IRAQ
Thank You!
This Presentation was created on 24/12/2020