COMP3600/6466 Algorithms
Lecture 12
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Dynamic Programming: Summary
1. Characterise the optimal substructure or show that none exists
2. Recursively define the value of an optimal solution
3. Compute the value of a
COMP3600/6466 Algorithms
Lecture 5
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Pseudocode Analysis
Iterative
COMP3600/6466 - Lecture 5 - 2016
Recursive
2
Recursive Algorithms
Total running time
=
Sum of times in each node of the recursion tree.
Can also b
COMP3600/6466 Algorithms
Lecture 7
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Quick Sort
https:/www.youtube.com/watch?v=ywWBy6J5gz8
COMP3600/6466 - Lecture 7 - 2016
2
Combine: Because the subarrays are already
them: the entire array Ap : : r! is now sor
11. Hash Tables
11.1. Direct-address tables
Many applications require a dynamic set that supports only the directory
operations INSERT, SEARCH and DELETE.
A hash table is a generalization of the simpler notion of an ordinary array.
Directly addressing int
6. Heapsort
6.1 Heaps
A binary heap is a nearly complete binary tree without child-parent pointers,
usually stored as an array. Each node (array element) contains a value (key) and
perhaps data associated with the key.
The tree is completely filled on all
COMP3600/6466 Algorithms
Lecture 3
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Asymptotic notations
O(g(n)= cfw_f (n)
: there exist positive constants c and n0 such that
0 f (n) c g(n) for all n n0 , e.g. 8 lg n = O(n).
(g(n)= cfw_f (n) : there exist posi
COMP3600/6466 Algorithms
Lecture 11
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Dynamic Programming: Summary
1. Characterise the optimal substructure or show that none exists
2. Recursively define the value of an optimal solution
3. Compute the value of a
COMP3600/6466 Algorithms
Lectures 1-3 Summary
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Todays algorithms can solve:
Face Recognition
Data Compression
Power System Design
Weather Forecasting
Financial Trading
Data Encryption
Data Routing
Integrated Circ
COMP3600/6466 Algorithms
Lecture 13
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
m!1
n!1
LCSs is longer is an LCS of X and Y . Because these cases exhaust all possibi
we know that one of the optimal subproblem solutions must appear within an
of X and Y .
W
COMP3600/6466 Algorithms
Lecture 14
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
subset of mutually compatible activities. We assume that the activit
in monotonically increasing order of finish time:
f1 ! f2 ! f3 ! # # # ! fn!1 ! fn :
(We shall5:
seeThe
la
COMP3600/6466 Algorithms
Lecture 6
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Divide and Conquer
COMP3600/6466 - Lecture 6 - 2016
2
Divide and Conquer
1. Divide A into a number of subproblems with equal size roughly.
2. Conquer the subproblems by solving
COMP3600/6466 Algorithms
Lecture 9
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Optimisation Problems
Every real-life problem can be formulated as an optimisation problem.
An optimisation problem is defined by a set of constraints and an objective
function
COMP3600/6466 Algorithms
Lecture 8
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Problem Complexity
We can use asymptotic bounds to bound the running time of algorithms.
We can also use these notations to bound the complexity of problems.
We say that (f (n)
COMP3600/6466 Algorithms
Lecture 2
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Algorithm Analysis
Why do we need it?
New
Algorithm
Problem
Existing
Algorithms
Time is a very expensive commodity
COMP3600/6466 - Lecture 2 - 2016
2
Algorithm Analysis
VS
Thre
11. Hash Tables (Cont.)
11.3. Hash functions
We deal with issues on the design of good hash functions. A good hash function
satisfies the assumption of simple uniform hashing:
Each key is equally likely to hash to any of the m slots in the hash table,
ind
COMP3600/6466 Algorithms
Lecture 1
S2 2016
Dr. Hassan Hijazi
Prof. Weifa Liang
Course logistics - Part 1
Textbook: Introduction to Algorithms
T. H. Cormen, C. E. Leiserson, R. L. Rivest and C. Stein. The MIT
Press, 3rd Edition, 2009 or later.
Lecturers: