36794852-Lower-Bound-Theory.doc

download 36794852-Lower-Bound-Theory.doc

of 7

Transcript of 36794852-Lower-Bound-Theory.doc

LOWER BOUND THEORY

If two algorithm for solving the problem where discovered and their times differed by an order of magnitude, the one with the smaller order was generally regarded as superior.

THE PURPOSE OF LOWER BOUND THEORY Is to find some techniques that have been used to establish that a given alg is the most efficient possible.

THE SOLUTION OR TECHNIQUE It is by discovering a function g(n) that is lower bound on the time that any algorithm must take to solve the given problem. If we have an algorithm whose computing time is the same order as g(n) then we know that asymptotically we can do no better (i.e. this alg is the most efficient one, no other alg can be derived more efficient then this) TRIVAL LOWER BOUNDS Lower bounds which are so easy to obtain is called trivial lower bounds. E.g All alg that finds the maximum of are unordered set of n integers. Clearly every integer must be examined at least once. So (n) is a lower bound for any alg that solves this problem.

SOME TECHNIQUES OR COMPUTATIONAL MODEL FOR FINDING LOWER BOUNDS.

1. Comparison trees.

2. Oracle and adversary argument

3. Lower bound through reductions.

1. Comparison Trees

a) Ordered Searching

Only comparison based algorithms are considered

The process of searching algorithms can be described by a path in a binary tree.

Each internal node in this tree represent a comparision between rc and A[i]

There are three possible out come of this comparison. X < a[I]| x = a[I]|x > a[I]

If x = a[i] the lag terminates.

If the alg terminates following a left or right branch, then a[I] has been found s.t x = a[I] & alg must declare the search unsuccessful.Theorem 10.1

Let a[1:n], n> 1 contains n distinct elements, ordered that a[1] < . . . < A[n]. Let Find (n) be the minimum number of comparisons needed, in the worst case, by any comparison based alg. To recognize whether X A [1:n]. The FIND (n) log (n+1)

Proof

Consider all possible comparison trees that model alg to solve the searching problem

FIND(n) Lessthan the distance of the longest path from the root to a leaf node.

There must be n internal nodes in all the these trees corresponding to the n possible successful occurrences of x in A

If all internal nodes of a binary tree are at levels less than or equal to K, them there are at most 2k-1 internal nodes.

Thus n < 2 k-1 and FIND (n) = k log (n+1). Hence Binary search is an optimal worst case algon for solving the searching problem.

B) Sorting

Consider the sorting algs (comparison based. Consider the case in which the n numbers a [1:n] to be sorted are distinct.

Any comparison between a[I] and a[j] will result in one of two possibilities A [I]< A [j] or A [j]> A [j]

So comparison tree is a binary tree in which each internal node is labeled by the pair I:j which represent the comparison of A[I], A[j]

If A[I] is less than A[j] then the alg. Proceeds down the left branch of the tree, otherwise it produces down the right branch.

External nodes represent termination of the alg.

There are n! different possible permutation of n items, and any one of there might legitimately be the only correct answer for sorting problem.

So comparison tree must have at least n! external nodes

E.g comparison tree for sorting three items

Consider only the comparison based sorting algorithms.

Let T(n) be the minimum number of comparisons that are sufficient to sort n items in the worst case. Casing knowledge of Binary trees) if all internal nodes are at levels less than k, then there are at most 2k external nodes (one more than no. of external nodes.)

Therefore, if we let k = T(n) N! 2T(n) Since T(n) is an integer, we get the lower bounds T(n) log n!

By stirlings approximation it follows that

Log n! = n log n n /ln2 + (1/2) log n + O(1)

This formula shows that T(n) is of the order n log n.

Hence any comparison based sorting algorithm needs (n log n) time.