COT 5407 U01/RXA - INTRODUCTION TO ALGORITHMS - FALL 2015
Advanced Design and Analysis Techniques
Allan Manamel | Panther ID : 5700508
Q1. Show how to compute the length of an LCS using only 2 * min (m, n) entries in the c
table plus O (
Chapter 13: Red-Black Trees
A red-black tree is a node-colored BST.
Each node is colored either black or red. The
following special rules apply:
1. The root is always black.
2. A nil is considered to be black. This
means that every non-NIL node has two
Recurrence: Solve, Prove, Ruminate.
September 14, 2005
T (0) = 0
T (n) =
T (i) + cn, n > 0.
Prove your answer. What is the asymptotic order of T (n)? What can you say about
Solution (creating a
CBs Answers, Asst. 2
CSC 172 8 Sept. 1997
Read the handout on Mathematical Preliminaries. 1. How many different 5-card draw poker hands may be dealt from a 52 card deck? 52 choose 5, or , or
2. How many different 5-card draw poker hands may be dealt from
Chapter 9: Medians and Order Statistics
The selection problem is the problem of
computing, given a set A of n distinct
numbers and a number i, 1 i n, the ithh
order statistics (i.e., the ith smallest
number) of A.
We will consider some special cases of th
Suppose that a situation in which an
application that employs hashing is repeatedly
executed and in which the hash function is
selected from a pool of hash functions at
Let H be the pool of hash functions.
We say that H i
g v V t v t g f d t u P &d t U X V u iz V wd V X z Wf X bV f d f z V v f z u g u cfw_ W f z U W f d U g W 6V g U X V f z wV Piz wV g d (V &dX V f z g g r t v t " u X V H X V R G u X u 6 W f z f FU V V z V V X V v v v t z t t u V V X V t u &FU Pz d t U e
COT5407 Fall 2006 Quiz #1
Instructor: Tao Li
September 7th, 2006
1. Let R be the binary relation over the set of real number, dened by
(A, B) R A is a proper subset of B.
For each of the following statements below, answer whether it is t
Example of Inserting Sorted Numbers
x 1 2 3 4 5 6 7 8 9 10
1 Insert 1. A leaf so red. Realize it is root so recolor to black.
make 2 red. Parent is black so done. 1 2
1 Insert 3. Parent is red. Parent's sibling is black (null) 3 is
Many of the slides are from Prof. Plaisteds resources at University of North Carolina at Chapel Hill
Input: A set A of n distinct numbers and a number i, with 1 i n. Output: the eleme
External Memory Dictionary Task: Given a large amount of data that does not t into main memory, process it into a dictionary data structure.
Need to minimize number of disk accesses
With each disk read, read a whole block of data
Construct a balanced s
Some of the slides are from Prof. Leong Hon Wais resources at National University of Singapore
Incrementing a Binary Counter
k-bit Binary Counter: A[0.k1]
i =0 A[i ] 2
1. i 0
2. while i < length
Chapter 24: Single-Source Shortest Paths
Given: A single source vertex in a weighted, directed graph. Want to compute a shortest path for each possible destination.
Similar to BFS.
We will assume either
no negative-weight edges, or no reachable negati
Elementary Sorting Algorithms
Many of the slides are from Prof. Plaisted's resources at University of North Carolina at Chapel Hill
Input: n records, R1 . Rn , from a file. Each record Ri has
a key K possibly other (satellite) infor
0, 1, 1, 2, 3, 5, 8, 13, 21,
where each number is the sum of the
F(0) = 0;
F(1) = 1;
F(number) = F(number-1)+ F(number2);
Redundant Calculations I
To compute fib(n), we
Growth rates of functions:
In a loglog chart, the slope of the line corresponds to the growth rate of the function
T (n )
Linear n Quadratic n2 Cubic n3
1E+30 1E+28 1E+26 1E+24 1E+22 1E+20 1E+18 1E+16 1E+14 1E+12 1E+10 1E+8 1E+6 1E+4 1E+2
COT 5407: Introduction to Algorithms
ECS318; Phone x6036 : taoli@ cs.fiu.e du
http:/www.cs.fiu.e du/~taoli/class/C OT5407-F09/inde x.htm l
Why should I care about Algorithms?
Cartoon from Intractability by Garey and Johnson