[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: can `shuffle-vector' be moved?
From: |
Ted Zlatanov |
Subject: |
Re: can `shuffle-vector' be moved? |
Date: |
Fri, 13 May 2011 09:38:59 -0500 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
On Fri, 13 May 2011 11:00:10 -0300 Stefan Monnier <address@hidden> wrote:
>>> (loop
>>> for i from (1- (length vector)) downto 1
>>> do (rotatef (aref vector i) (aref vector (random i)))))
>> Why is this limited to vectors? with elt it could work also with lists.
SM> Its algorithmic performance on lists would be poor (O(N²)).
SM> You want a different algorithm for lists.
I think the performance would not be bad if the list was put into a
vector, shuffled, then put back--just O(N) with twice the memory usage.
That could be a wrapper around the vector shuffle so it can handle
general sequences.
Ted
- Re: can `shuffle-vector' be moved?, (continued)
- Re: can `shuffle-vector' be moved?, Ted Zlatanov, 2011/05/12
- Re: can `shuffle-vector' be moved?, Kevin Rodgers, 2011/05/13
- Re: can `shuffle-vector' be moved?, Ted Zlatanov, 2011/05/13
- Re: can `shuffle-vector' be moved?, Stefan Monnier, 2011/05/13
- Re: can `shuffle-vector' be moved?, Ted Zlatanov, 2011/05/13
- Re: can `shuffle-vector' be moved?, Stefan Monnier, 2011/05/13
- Re: can `shuffle-vector' be moved?, Ted Zlatanov, 2011/05/13
Re: can `shuffle-vector' be moved?, Thierry Volpiatto, 2011/05/13