Chris Stephenson wrote:
But, on the other hand, O(log n) is, for most practical purposes, very
close to O(1), so why worry?
Because we're not consistent about when we worry and when we don't. This
thread, for example, is mostly about logarithmic factors. And we
wouldn't accept a statement li
> You get some very funny timings, because
> Python arrays are not so simple. Or they weren't, the last time I tried
> this.
They haven't become simpler. Ditto for every other scripting
language, because the arrays are really hash table references.
Shriram
___
On 13/09/10 23:19, Prabhakar Ragde wrote:
> One of the things that irritates me about a conventional algorithms
> course is that the underlying model is so fuzzy. When we talk about an
> input of size n, we are really assuming a RAM model with word size c log
> n for some constant c big enough to i
On 9/13/10 2:46 PM, Stephen Bloch wrote:
Do you know a better way to shuffle a list than to convert it to a
vector, shuffle in place, then convert back to a list? You might look
at this discussion:
http://groups.google.com/group/comp.lang.scheme/browse_thread/thread/24270db01f684439/e54c99564028
Fisher-Yates is O(n). It visits each element once, choosing a random
equal-or-forward element and swapping it with the current element. And it
is fair in the sense that, given a proper random-number generator, each
permutation of the input is equally likely.
All of the purely-functional methods
David Van Horn wrote:
On 9/13/10 2:46 PM, Stephen Bloch wrote:
On Sep 13, 2010, at 1:34 PM, Phil Bewig wrote:
Do you know a better way to shuffle a list than to convert it to a
vector, shuffle in place, then convert back to a list? You might look
at this discussion:
http://groups.google.com/gr
On 9/13/10 2:46 PM, Stephen Bloch wrote:
On Sep 13, 2010, at 1:34 PM, Phil Bewig wrote:
Do you know a better way to shuffle a list than to convert it to a
vector, shuffle in place, then convert back to a list? You might look
at this discussion:
http://groups.google.com/group/comp.lang.scheme/br
On Sep 13, 2010, at 1:34 PM, Phil Bewig wrote:
> Do you know a better way to shuffle a list than to convert it to a vector,
> shuffle in place, then convert back to a list? You might look at this
> discussion:
> http://groups.google.com/group/comp.lang.scheme/browse_thread/thread/24270db01f684
8 matches
Mail list logo