Transcript Lecture13

Design and Analysis of Algorithms
Review
Haidong Xue
Summer 2012, at GSU
Measurement of
running time
Analysis
Asymptotic
notations
Probabilistic
analysis
Divide &
Conquer
Design
Algorithms
Dynamic
Programming
Greedy
Classic
problems and
their algorithms
Dynamic set model
Data
structures
Hash tables
Binary search trees
NPCompleteness
1. Algorithm analysis
• What is an algorithm?
• What are we interested about an algorithm?
• How to measure the running time of an
algorithm?
• What are asymptotic notations?
• Can you tell the asymptotic relation between
two functions?
2. Algorithm design
• What is a divide-and-conquer algorithm?
• How to design a divide-and-conquer
algorithm?
• How to code a divide-and-conquer algorithm?
– Recursion
• How to calculate the running time of a divideand-conquer algorithm?
– Recurrence equation
2. Algorithm design
• Problems efficiently solved by divide-andconquer
– Maximum sub-array
– Matrix multiplication
– Sorting
• Quick sort, merge sort
2. Algorithm design
• When to apply dynamic programming strategy?
• What is a dynamic programming algorithm?
• What are the two manners to dynamic
programming algorithms?
• Problems efficiently solved by dynamic
programming
–
–
–
–
Matrix chain multiplication
Longest common sequence
Bellman-Ford algorithm
Floyd-Warshall algorithm
2. Algorithm design
• What is a greedy algorithm?
• When is a greedy algorithm correct?
• Problems efficiently solved by greedy algorithms
–
–
–
–
–
–
Coin changing with certain coin denominations
Activity selection
Fractional knapsack
Dijkstra’s algorithm (single-source shortest path)
Kruskal’s algorithm (MST)
Prim’s algorithm (MST)
3. Sorting algorithm
• What are comparison based sorting algorithms?
• What is the lower bound of comparison based
sorting algorithms?
• Classic comparison based sorting algorithms
–
–
–
–
Insertion sort
Merge sort
Quick sort
Heap sort
• Non-comparison based sorting algorithms
– Counting sort
4. Graph related algorithms
•
•
•
•
What is a directed graph?
What is a undirected graph?
What are the two representations of graphs?
BFS, DFS, BFS-Traversal, DFS-Traversal
– Topological sort, unweighted shortest path
• MST
– Kruskal; Prim
• Single-source shortest path
– Bellman-Ford; Dijkstra
• All-pair shortest path
– Floyd-Warshall
• Vertex-cover – NP-complete
• Travelling salesman problem – NP-complete
5. Data structures
• What is the dynamic set model?
• What are the operations on a dynamic set?
• Hash tables
– What are hash tables?
– What is the worst case running time of each operation?
– Hash functions
• Multiplication hashing; division hashing; universal hashing
• Open address
• Binary search tree
– Binary search tree properties
– Algorithms of each dynamic set operation
– Red-black tree
6. NP-Complete
• What are P and NP problems?
• What are NP-complete problems?
– NP-Hard
• How to prove a problem is NP-complete?
• What are approximation algorithms for NPcomplete problems?
• What is the approximation ratio?
6. NP-Complete
• Classic approximation algorithms for some
NPC problems
– Vertex cover
– Set cover
– TSP
Database
Algorithms
Software
Computer
Data Structure
Programming Language
Compiler
Principles of Compilers
Machine
Language
Operating System
Computer Architecture
Computer Composition
Hardware
Microchip Interfaces
VLSI Design
Applications
Software Engineering
Network
Data mining
Wireless Network
Web programming
Signal processing
AI
Automata
Robotics
Security
Graphics