Re: problem on medians
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Thu, 31 May 2007 14:19:07 -0400
Richard Heathfield wrote:
CBFalconer said:
Richard Heathfield wrote:
ak said:
what are the least no. of comparisons to find the medain of a set
of n integers ?
I presume you mean "median".
The answer is of course 0, which occurs when n is 0, 1, or 2. For
n = 0, there is nothing to compare, so no comparisons can occur.
When n is 1, there is only one value, which is its own median, so
no comparison is required. When n is 2, the median is given by the
sum of the two elements divided by 2, and again no comparison is
required.
Harumph. He didn't say "set of n non-negative integers". :-)
I didn't say he did. But n itself must be non-negative - or are you
claiming that you can have a set of integers that has fewer than no
members?
I am claiming that the 'set of integers' can have negative
members. On re-reading, maybe I jumped the gun.
--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net
--
Posted via a free Usenet account from http://www.teranews.com
.
- Follow-Ups:
- Re: problem on medians
- From: Richard Heathfield
- Re: problem on medians
- References:
- problem on medians
- From: ak
- Re: problem on medians
- From: Richard Heathfield
- Re: problem on medians
- From: CBFalconer
- Re: problem on medians
- From: Richard Heathfield
- problem on medians
- Prev by Date: Re: problem on medians
- Next by Date: Re: Web vs. Desktop based systems
- Previous by thread: Re: problem on medians
- Next by thread: Re: problem on medians
- Index(es):
Relevant Pages
|