Problem 1 Clarification - "The ith smallest element of a list"
  Home FAQ Contact Sign in
uw.cs.cs341 only
 
Advanced search
POPULAR GROUPS

more...

uw.cs.cs341 Profile…
 Up
Problem 1 Clarification - "The ith smallest element of a list"         


Author: Vivien
Date: Feb 21, 2008 22:04

Hi,

Problem 1 asks us to use MEDIAN to find the ith smallest element of a
list A in linear time. When they say "the ith smallest element of a
list", does that mean we should return the ith smallest element
including OR excluding duplication of elements?

Say for example, if we want the second smallest element of the list
[1;1;1;2;2;6;6;6;9;9;10], should it return '1' or should it return
'2'?

Thanks,

Vivien
1 Comment
Re: Problem 1 Clarification - "The ith smallest element of a list"         


Author: Jeff Verkoeyen
Date: Feb 22, 2008 10:25

In class it was mentioned that you should literally return the ith
smallest element of the sorted list.

In your example, the second smallest element would be 1. A[2] assuming
a 1-based array.
Show full article (0.66Kb)
no comments