CS401A's Prelims: Design and Analysis of Algorithms Flashcards
For preliminary exams. (52 cards)
Review of Algorithms
“A computer is a stupid machine
with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things.”
According to Bill Bryson,
Review of Algorithms
A set of finite and detailed step-by-step instructions performed to complete a specific task is what we call an
algorithm.
Review of Algorithms
Did you know that the word algorithm comes from Persian scientist, mathematician, and author
Abu Abdullah
Muhammad bin Musa al-Khwarizmi,
Review of Algorithms
on the other hand, is the design and analysis of computer algorithms.
Algorithmics,
Review of Algorithms
pertains to the method or mathematical process behind the conception of an algorithm
The design part
Review of Algorithms
while the
deals with the determination of the
computational complexity of an algorithm.
analysis part
Review of Algorithms
starts from defining the
problem cautiously by describing the set of instances
Notion of Algorithm
Review of Algorithms
The algorithm
will often be divided into sections:
Parts/Components (Input)
Actions/Steps/Methods (Processing)
Outcome (Output)
Review of Algorithms
Characteristics of Algorithm
For an algorithm to be useful, it must help find the solution to a specific problem. For that to happen, an algorithm must satisfy five (5) properties.
- Input Specification
- Output Specification
- Definiteness
- Finiteness
- Effectiveness
Review of Algorithms
Characteristics of Algorithm
The inputs must be clearly
identified.
- Input Specification
Review of Algorithms
Characteristics of Algorithm
The output, as well as its
relationship to the input/s, must be clearly
identified
- Output Specification
Review of Algorithms
Characteristics of Algorithm
The steps in the algorithm must be
precisely defined;
- Definiteness
Review of Algorithms
Characteristics of Algorithm
The algorithm must always come to an
end after a finite number of steps and using a finite
amount of resources.
- Finiteness
Review of Algorithms
Characteristics of Algorithm
All operations to be performed
must be sufficiently basic that they can be done
exactly and in finite time.
- Effectiveness
Review of Algorithms
Representation of Algorithm
An algorithm is represented using two (2) common
techniques:
- Pseudocode
- Flowchart
Review of Algorithms
_____ means imitation
Pseudo
Review of Algorithms
_____ refers to instructions written in a programming
language.
code
Review of Algorithms
This term is a generic way of describing an algorithm without using any specific
programming language-related notations.
Pseudocode
Review of Algorithms
It is a method of expressing an algorithm
by a collection of connected geometric shapes containing descriptions of the algorithm’s steps.
Flowchart
Review of Algorithms
Common Pseudocode Notation
There is no strict set of standard notations for
pseudocode, but the most widely recognized are:
○ Input
○ Output
○ If-Then-Else
○ For
○ Repeat-Until
○ While
Review of Algorithms
-
indicates a user will be inputting
something.
○ Input
Review of Algorithms
-
indicates that an output will
appear on the screen.
○ Output
Review of Algorithms
-
a decision (selection) in which a choice is made any instructions that occur inside a selection or iteration are usually indented.
○ If-Then-Else
Review of Algorithms
-
a counting loop (iteration)
○ For