Lecture 2 Notes
Algorythms
Informally,
A tool for solving a well-specified computational problem.
Example: sorting
input: A sequence of numbers.
output: An ordered permutation of the input.
issues: correctness, efficiency, storage, etc.
An algorithm is
Announcements
Weekly
Reading Assignment:
Chapter 9 (CLRS)
UNC Chapel Hill
M. C. Lin
Order Statistic
order statistic of a set of n elements is the ith
smallest element
ith
Minimum:
the first order statistic
Maximum:
the nth order statistic
Selection
p
Announcements
Homework
Reading
UNC Chapel Hill
5 due on 3/?/2016
Assignment: Ch. 16 (CLRS)
M. C. Lin
Optimization Problems
In
which a set of choices must be made in
order to arrive at an optimal solution,
subject to some constraints. (There may
be seve
Announcements
Homework
Reading
UNC Chapel Hill
#4 due on 3/10/2016
Assignment: Ch. 22 (CLRS)
M. C. Lin
Graphs
A
collection of vertices or nodes, connected
by a collection of edges.
Applicable
to many applications where there
is some connection or relat
Announcements
Reading
Quiz#4
Assignment: Ch. 24 (CLRS)
on Graphs
Homework#5
UNC Chapel Hill
due on March 31st, 2016
M. C. Lin
Definitions for Shortest Paths
Think
of vertices as cities and the edge weights
as the distance from one city to another. Def
Properties of DFS
Predecessor
subgraph G forms a forest
of trees (the structure of a depth-first
tree mirrors the structure of DFS-Visit)
The
discovery and finishing time have
parenthesis structure, i.e. the parentheses
are properly nested. (See the fig
Properties of DFS
Predecessor
subgraph G forms a forest
of trees (the structure of a depth-first
tree mirrors the structure of DFS-Visit)
The
discovery and finishing time have
parenthesis structure, i.e. the parentheses
are properly nested. (See the fig
Announcements
Reading
Quiz#4
Assignment: Ch. 24 (CLRS)
on Graphs
Homework#5
UNC Chapel Hill
due on March 31st, 2016
M. C. Lin
Definitions for Shortest Paths
Think
of vertices as cities and the edge weights
as the distance from one city to another. Def
Announcements
Reading
UNC Chapel Hill
Assignment: Ch. 23 (CLRS)
M. C. Lin
Minimum Spanning Trees
Problem:
Connect a set of nodes
by a network of minimal total
length
Some applications:
Communication networks
Circuit design
Layout of highway systems
UN
Announcements
Reading
UNC Chapel Hill
Assignment: Ch. 23 (CLRS)
M. C. Lin
Minimum Spanning Trees
Problem:
Connect a set of nodes
by a network of minimal total
length
Some applications:
Communication networks
Circuit design
Layout of highway systems
UN
Huffman Encoding
Chapter 16-3 (CLRS)
Entropy
Entropy
is a measure of information content: the
number of bits actually required to store data.
Entropy sometimes also called a measure of
surprise
A highly predictable sequence contains little
actual infor
Announcements
Homework
Reading
UNC Chapel Hill
#6 due on April 12, 2016
Assignment: Ch. 15 (CLRS)
M. C. Lin
Steps in DP: Step 1
Think
what decision is the last piece
in the puzzle
Where to place the outermost
parentheses in a matrix chain
multiplicati
Huffman Encoding
Chapter 16-3 (CLRS)
Entropy
Entropy
is a measure of information content: the
number of bits actually required to store data.
Entropy sometimes also called a measure of
surprise
A highly predictable sequence contains little
actual infor
Announcements
Homework
#6 due on April 12, 2016
Extra
Help Session on Dynamic
Programming this Friday, April 8th, at
4pm in SN014
Reading
UNC Chapel Hill
Assignment: Ch. 15 (CLRS)
M. C. Lin
Assembly-Line Scheduling
Two
parallel assembly lines in a fac
Announcements
Homework
#2 due on Tuesday, 2/9/16
Weekly
Reading Assignment:
Chapter 5-7 (CLRS)
Extra
Help Sessions:
Wednesday, Feb 3, 2016 @ 4pm in SN014
Thursday, Feb 4, 2016 @ 4:30pm in SN008
M. C. Lin
Review on Heap Data Structure
Construct
in (n)
Review on Sorting
Basics
of Sorting
Elementary
Sorting Algorithms
Selection sort
Insertion sort
Shellsort
Comparison-based
Sort
Heap sort
Binary sort
Quick sort
UNC Chapel Hill
M. C. Lin
Sorting
Given
n records, R1 Rn , called a file. Each recor
Iteration Method
Expand
(iterate) the recurrence and express it as
a summation of terms dependent only on n and
the initial conditions
The
key is to focus on 2 parameters
the number of times the recurrence needs to be
iterated to reach the boundary con
Lecture 2 Notes
Algorythms
Informally,
A tool for solving a well-specified computational problem.
Example: sorting
input: A sequence of numbers.
output: An ordered permutation of the input.
issues: correctness, efficiency, storage, etc.
An algorithm is
Lecture 3 Notes
Complexity of an algorithm generally depends on
Size of input.
Input size depends on the problem.
Examples: No. of items to be sorted.
No. of vertices and edges in a graph.
Other characteristics of the input data.
Are the items already so
Lecture 3 Notes
Complexity of an algorithm generally depends on
Size of input.
Input size depends on the problem.
Examples: No. of items to be sorted.
No. of vertices and edges in a graph.
Other characteristics of the input data.
Are the items already so
Lecture 4 Notes
Logical expression with the following properties.
Holds true before the first iteration of the loop Initialization.
If it is true before an iteration of the loop, it remains true before the next
iteration Maintenance.
When the loop termin
Lecture 4 Notes
Logical expression with the following properties.
Holds true before the first iteration of the loop Initialization.
If it is true before an iteration of the loop, it remains true before the next
iteration Maintenance.
When the loop termin
Lecture 5 Notes
Recursive in structure
Divide the problem into sub-problems that are similar to the original but
smaller in size
Conquer the sub-problems by solving them recursively. If they are small
enough, just solve them in a straightforward manner.
Lecture 5 Notes
Recursive in structure
Divide the problem into sub-problems that are similar to the original but
smaller in size
Conquer the sub-problems by solving them recursively. If they are small
enough, just solve them in a straightforward manner.
Study Guide 1
Heapsort (Exam Part 1)
Combines the better attributes of merge sort and insertion sort.
Like merge sort, but unlike insertion sort, running time is O(n lg n).
Like insertion sort, but unlike merge sort, sorts in place.
Introduces an algori
Study Guide 2
Part 1 Consist of:
Edit distance: Given 2 sequences, X = x1,.,xm and Y = y1,.,yn , what is the
minimum number of deletions, insertions, and changes that you must do to change
one to another?
Protein sequence alignment: Given a score matrix
COMP 550
Algorithms and Analysis
Spring 2008
Second Mid Semester Exam
Thursday, March 27, 2008
Closed Book - Closed Notes
Dont forget to write your name or ID and pledge on the exam sheet.
This exam has three pages.
1. (12 points) (a) Give an upper bound
Linear Programming
Chapter 29 (CLRS)
Comp550 Algorithms & Analysis
Announcements
Bonus Programming Assignment due on Monday,
April 18th, 2016.
(Submit by emailing the corresponding TA. Coordinate with
TA about meeting to demo & testing, or extension.)
H
Announcements
Reading Assignment:
Ch. 23 (CLRS)
Extra
Help Session on Dijkstras Alg.
this Wednesday, March 30th @ 4pm in
SN014
UNC Chapel Hill
M. C. Lin
Intuition behind Prims Algorithm
Consider
the set of vertices S currently part of
the tree, and its c
COMP550: Algorithms & Analysis
Tues/Thur 12:30pm 1:45pm (SN 014)
http:/www.cs.unc.edu/~lin/COMP550/
Ming C. Lin
FB 254, 919-590-6074
[email protected]
Office Hours: Before/After Class or
By Appointment
UNC Chapel Hill
M. C. Lin
Teaching Assistants
Yen-Chun