Post on 12-Jan-2022
transcript
Design and Analysis
of AlgorithmsIF184401
Translated & adapted from Rully Soelaiman’s works
[rully130270@gmail.com]
Department of Informatics
Faculty of Intelligent Electrical and Informatics Technology
Institut Teknologi Sepuluh Nopember1
1. Able to model a computational problem algorithmically
2. Able to apply an optimal algorithm’s design towards a given computational problem
3. Able to analysis an algorithm’s design which covering the correctness and complexityaspects
4. Able to implement an algorithm’s design by involving the efficient data structure by using object-oriented programming (C++)
2
1. Chapter 02. Getting Started
2. Chapter 03. Growth of Functions
3. Chapter 04. Divide-and-Conquer
4. Chapter 15. Dynamic Programming
5. Chapter 16. Greedy Algorithms
6. Chapter 22. Elementary Graph Algorithms
7. Chapter 24. Single-Source Shortest Paths
8. Chapter 25. All-Pairs Shortest Paths
3
• Algorithm
• Outline, the essence of a computational
procedure, step-by-step instructions
• Program – an implementation of an
algorithm in some programming language
• Data structure
• Organization of data needed to solve the
problem
Data Structures and Algorithms
18
Overall Picture
Data Structure and
Algorithm Design Goals
Implementation
Goals
Correctness
Efficiency
Robustness
Adaptability
Reusability
19
Sort
Example: Sorting
INPUTsequence of numbers
a1, a2, a3,….,anb1,b2,b3,….,bn
OUTPUTa permutation of the
sequence of numbers
2 5 4 10 7 2 4 5 7 10
Correctness
For any given input the algorithm
halts with the output:
• b1 < b2 < b3 < …. < bn
• b1, b2, b3, …., bn is a
permutation of a1, a2, a3,….,an
Running time
Depends on
• number of elements (n)
• how (partially) sorted
they are
• algorithm
20
Designing Algorithms
• Several techniques/patterns for designing
algorithms exist
• Incremental approach: builds the solution one
component at a time
• Divide-and-conquer approach: breaks original
problem into several smaller instances of the
same problem
21