The run time of this algorithm is given by the recursive equation
Given a sequence
X = <x1, x2, ., xn>
a sequence of length k
Z = <z1, z2, ., zk>
is a subsequence if there exists a strictly increasing
The question now is how do we construct a hashing function that satisfies the desired
property of simple uniform hashing? The answer to this question is usually dependent
on the distribution of the ke
Directed Graph (digraph)
In a directed graph, the edges are represented by ordered pairs of vertices (u, v) and
shown diagramatically as directed arrows (a vertex may be connected to itself via
a self
Chain Operations
INSERT(T, x) - place new element x at the head of list h(k) - O(1) assuming element is
not in list, otherwise need to search list
DELETE(T, x) - delete element x from list at T(h[x.ke
Birthday Paradox
Another interesting problem that can be solved with indicator random variables is the
well known birthday paradox problem. The problem is - "How many people do you
need in a room to h
Step 1: Characterize optimality
Without loss of generality, we will assume that the a's are sorted in non-decreasing
order of finishing times, i.e. f1 f2 . fn.
Define the set Sij
Sij = cfw_ak S : fi s
Hiring Problem
Consider that you are in charge of hiring and are looking to fill an office position. The
prospective candidates are sent by an employment agency and are assumed to be
numbered 1.n. You
Let us first formalize the problem by assuming that a piece of length i has price pi. If
the optimal solution cuts the rod into k pieces of lengths i1, i2, . , ik, such
that n = i1 + i2 + . + ik, then
Construction
1. Select a prime number p such that for every key k (clearly p > m)
0 k p-1
2. Randomly select a constant a such that
1 a p-1
3. Randomly select a constant b such that
0 b p-1
4. Constru
Longest Common Subsequence
Given two sequences X of length m and Y of length n as
X = <x1, x2, ., xm>
Y = <y1, y2, ., yn>
find the longest common subsequence (LCS).
Step 1: Characterize optimality
The
Indicator Random Variables
The technique of indicator random variables is based upon the concept of
an event either occuring or not occuring. Thus for an event A (which is a random
event), we will def