P. 1
Algorithms Design Techniques and Analysis

Algorithms Design Techniques and Analysis

|Views: 215|Likes:
Published by narasimha2357

More info:

Published by: narasimha2357 on Feb 19, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





In Sec. 12.3.2, we will show that the running time of any algorithm that
sorts an array with n entries using element comparisons must be Ω(nlogn)
in the worst case (see Sec. 1.12). This means that we cannot hope for an
algorithm that runs in time that is asymptotically less than nlogn in the
worst case. For this reason, it is commonplace to call any algorithm that
sorts using element comparisons in time O(nlogn) an optimal algorithm
for the problem of comparison-based sorting. By this definition, it follows
that Algorithm bottomupsort is optimal. In this case, we also say that
it is optimal within a multiplicative constant to indicate the possibility of
the existence of another sorting algorithm whose running time is a constant
fraction of that of bottomupsort. In general, if we can prove that any
algorithm to solve problem Π must be Ω(f(n)), then we call any algorithm
to solve problem Π in time O(f(n)) an optimal algorithm for problem Π.
Incidentally, this definition, which is widely used in the literature, does
not take into account the space complexity. The reason is twofold. First,
as we indicated before, time is considered to be more precious than space
so long as the space used is within reasonable limits. Second, most of
the existing optimal algorithms compare to each other in terms of space
complexity in the order of O(n). For example, Algorithm bottomupsort,
which needs Θ(n) of space as auxiliary storage, is called optimal, although
there are other algorithms that sort in O(nlogn) time and O(1) space. For
example, Algorithm heapsort, which will be introduced in Sec. 4.2.3, runs
in time O(nlogn) using only O(1) amount of space.

How to Estimate the Running Time of an Algorithm


You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->