comp.lang.ada
 help / color / mirror / Atom feed
* Quick Sort Median of Three worst case
@ 2003-01-30 22:25 goms
  2003-01-30 23:51 ` Bobby D. Bryant
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: goms @ 2003-01-30 22:25 UTC (permalink / raw)


Hi,

I would like to know the running time of the Median of Three routine
version Quick Sort for the following input

(a)      2, 3, 4, ..,N-1, N, 1

What is the running time for the following input

(b)      1, N, N-1, ....., 4, 3, 2

Is the above said inputs (a) and (b) the worst case? and is the
running time is O(N^2) ?

I know that using Median of Three routine version of Quick Sort for,

a) sorted input
  the pivot is always in the middle, so the time would be O(nlogn)

b) reverse-ordered input
  the pivot is always in the middle, so the time would be O(nlogn)


A reply with explanation will be great.  Thanks in Advance.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-01-31 12:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-30 22:25 Quick Sort Median of Three worst case goms
2003-01-30 23:51 ` Bobby D. Bryant
2003-01-31 12:28   ` Marin David Condic
2003-01-31  9:17 ` Wendy E. McCaughrin
2003-01-31  9:59 ` Albert van der Horst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox