Upload
anis-quinn
View
215
Download
3
Embed Size (px)
Citation preview
Joseph L. Lindo
Algorithms and Data StructuresSir Joseph LindoUniversity of the Cordilleras
Joseph L. Lindo
Case
What
How
Section 1
Algorithm
Why study algorithm?• Make a lot of money out of great algorithm
• $ 10000000000000000?
• Ex. PageRank Algorithm
Why
Joseph L. Lindo
Case
What
How
Section 1
Algorithm
Why study algorithm?• Make significant contribution to the society
• Ex. Viterbi Algorithm
Why
Joseph L. Lindo
Case
What
How
Section 1
Algorithm
Why study algorithm?• Simply to be cool to invent something in computer science or IT field
• Ex. Shortest Path Algorithm
Why
Joseph L. Lindo
Case
What
How
Why
Algorithm
Definition• An algorithm is a sequence of unambiguous instructions/operations for solving a problem for obtaining a required output for any legitimate input in a finite amount of time
What
Joseph L. Lindo
Case
What
How
Why
Algorithm
What
“computer”+programs
PROBLEM
ALGORITHM
INPUT OUTPUT
Data Structures
Map Navigation AB
Graphs Path
Joseph L. Lindo
Case
What
How
Why
Algorithm
Characteristics• Finiteness
- terminates after a number of steps
• Input- Valid inputs are clearly specified
• Output- can be proven to produce the correct outcome
What
Joseph L. Lindo
Case
What
How
Why
Algorithm
Characteristics• Definiteness- rigorously and unambiguously
specified
• Effectiveness- steps are sufficiently simple and basic
What
Joseph L. Lindo
Case
What
How
Why
Algorithm
Important Points• Each step of an algorithm is unambiguous
•The range of inputs has to be specified carefully
•The same algorithm can be represented in different ways
What
Joseph L. Lindo
Case
What
How
Why
Algorithm
Important Points•The same problem may be solved by different algorithms
•Different algorithms may take different time to solve the same problem – we may prefer one to the other
What
Joseph L. Lindo
Case
What
How
Why
Algorithm
Algorithmic ProblemSolving
What1. Understanding the problem
2. Ascertaining the capabilities of a computational device
3. Choose between exact and approximate problem solving
Joseph L. Lindo
Case
What
How
Why
Algorithm
Algorithmic ProblemSolving
What4. Deciding on appropriate data structure
5. Algorithm design techniques
6. Methods of specifying an algorithm(Pseudocode or diagram)
Joseph L. Lindo
Case
What
How
Why
Algorithm
Algorithmic ProblemSolving
What7. Prove an algorithm’s correctness – mathematic induction
8. Analyzing an algorithm – Simplicity, efficiency, optimality
9. Coding an algorithm
Joseph L. Lindo
Case
What
How
Why
Algorithm
Algorithm Analysis• Correctness
• Time efficiency
• Space efficiency
What
Joseph L. Lindo
Case
What
How
Why
Algorithm
In generalA good algorithm is a result of repeated effort and rework• Better data structure• Better algorithm design• Better time or space efficiency• Easy to implement• Optimal algorithm
What
Joseph L. Lindo
Case
What
How
Why
AlgorithmHow to studyAlgorithm?• Problem
• Representation/data structure in computer
• Operations on representations
How
Joseph L. Lindo
Case
What
How
Why
AlgorithmHow to presentAlgorithm?• Human Language
• Graphical representation (Flow Chart) -->
• Pseudo code -->
Sample Problem
How
Joseph L. Lindo
Case
What
How
Why
AlgorithmGroup Activity
Write the algorithm in borrowing a book at the University of the Cordilleras.
Represent the algorithm in:• Human Language• Flowchart• Pseudo code
Case
Joseph L. Lindo
Algorithms and Data StructuresSir Joseph LindoUniversity of the Cordilleras
Joseph L. Lindo
PageRank Algorithm
Algorithm
Joseph L. Lindo
PageRank Algorithm
Algorithm
• Created by Larry Page
• The “soul” of Google Search Engine
• Google total assets: $31 billions 2008
Joseph L. Lindo
Viterbi Algorithm
Algorithm
Joseph L. Lindo
Viterbi Algorithm
Algorithm
• conceived by Andrew Viterbi in 1967 as an error-correction scheme for noisy digital communication links
• Viterbi algorithm is a standard component of tens of millions of high-speed modems
Joseph L. Lindo
Viterbi Algorithm
Algorithm
• It is a key building block of modern information infrastructureDigitalcellular, dial-up modems, satellite, deep-space 802.11 wireless LANs. speech recognition, keyword spotting, computational linguistics, and bioinformatics.
Joseph L. Lindo
Shortest Path Algorithm
Algorithm
CLICK HERE FOR MORE INFO
Joseph L. Lindo
Shortest Path Algorithm
Algorithm
• Used in Google Maps
Joseph L. Lindo
Flow Chart Symbols
Algorithm
Joseph L. Lindo
Flow Chart Symbols
Algorithm
Joseph L. Lindo
Flow Chart Symbols
Algorithm
Joseph L. Lindo
Pseudo code
Algorithm
It is a cross between human language and a programming language
Joseph L. Lindo
Name Search Problem
Algorithm
“Create a program that will determine the number of times a name occurs in a list.”
Joseph L. Lindo
Human Language Representation
Algorithm
1. Get the list of names, let's call this nameList2. Get the name to look for, let's call this the keyname3. Compare the keyname to each of the names in nameList4. If the keyname is the same with a name in the list, add 1 to the count5. If all the names have been compared, output the result
Joseph L. Lindo
Flowchart Representation
Algorithm
Joseph L. Lindo
Pseudo code Representation
Algorithm
Let nameList = List of NamesLet keyName = the name to be soughtLet Count = 0For each name in NameList do the followingif name == keyName
Count = Count + 1Display Count