Re: Homework 8 - Median Function

1 view
Skip to first unread message

William Stein

unread,
May 23, 2011, 11:52:52 PM5/23/11
to Michael Snider, 480uw11
On Mon, May 23, 2011 at 8:51 PM, Michael Snider <snid...@gmail.com> wrote:
> Hello Professor Stein,
>
> In our median functions that we make, can we say that we expect ordered
> output? Or should I account for the case where the list is unordered.

Please write a function that can deal with the case where the list is
unordered, even though the given input [1..10^n] is ordered. Don't
worry, it isn't hard, since lists have a sort method:

sage: v = [3,8,1,2,5]
sage: v.sort()
sage: v
[1, 2, 3, 5, 8]


>
> Thanks,
>
> Michael Snider
>

--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Reply all
Reply to author
Forward
0 new messages