Lesson 3: Algorithm Design Techniques
Lesson 3: Algorithm Design Techniques
Outline
Divide-and-Conquer Algorithms
Most widely applicable
Break down the n-sized problem into
smaller problems in such a way that
the solutions of the smaller problems
can form the solution to the bigger
problem.
Eg.
Multiplying Long Integers
Modularization
Divide-and-Conquer Algorithms
Applications
Closest-points problems
Selection problems
Multiplying long integers
Matrix multiplication
Constructing tennis tournaments / hierarchy scheduling
Towers of Hanoi
Algorithms
Mergesort
Quicksort
Binary Search Trees
Dynamic Programming
An approach of rewriting the
recursive algorithm as a nonrecursive algorithms that
systematically records the answers
to the subproblems in a table.
Comes from CONTROL Theory
Dynamic Programming
Applications
Ordering Matrix Multiplications
Optimal BST
APSP
Triangulation Problems
Knapsack Problems
Algorithms
Floyds Algorithm
Greedy Algorithms
Select the Locally Optimal solution
at that time, without regard for
future consequence.
take what you can get now
At the end of the algorithm, we hope
that the LOCAL Optimum is
equivalent to the GLOBAL Optimum
Unfortunately, this isnt always true for
all problems
Greedy Algorithms
Applications
Scheduling problems
Huffman codes
Greedy Algorithm as Heuristics to Travelling
Salesman (Shortest Paths)
Coin-changing program
Algorithms
Dijkstras (SPSP)
Prims (Minimum cost spanning tree)
Kruskals (Minimum cost spanning tree)
Backtracking
A systematic, exhaustive search
technique that attempts to consider
all possible solutions.
Optimized by alpha-beta pruning
which reduces the search
substantially
Backtracking
Applications
Game AI: Checkers, Chess, Tic-tac-toe
Algorithms
DFS
Game AI Algorithms, Decision
Algorithms
Randomized Algorithms
Dice rolls
Quicksort
Pogo sort