Message181142
> It is trivial.
>
> def rotate(od, n):
> for i in range(n):
> k, v = od.popitem(False)
> od[k] = v
That's O(n), with many spurious insertions and deletions.
> And those functions look too specialized.
How so? rotating sounds quite generic to me. deques already allow
rotating. |
|
Date |
User |
Action |
Args |
2013-02-02 07:56:56 | pitrou | set | recipients:
+ pitrou, rhettinger, eric.snow, Ramchandra Apte, serhiy.storchaka |
2013-02-02 07:56:56 | pitrou | link | issue17100 messages |
2013-02-02 07:56:55 | pitrou | create | |
|