Post Reply 
Programming puzzles: processing lists!
06-12-2017, 10:19 PM
Post: #144
RE: Programming puzzles: processing lists!
(06-12-2017 09:51 PM)pier4r Wrote:  For lrot I thought you exploded the list and rolled the elements, as I do in user rpl.

This should be faster I think.

And thanks for sharing insights!

Explode/roll/implode would work ok for an argument of 1/-1, but you'd have to loop the rolls for other numbers. Once list sizes get into the hundreds, rolls start to slow down. Try the "roll" method on a list of 1000 items rotated by 500 (or -500). How does it do? LROT handles that in about .19 seconds.

The method I want to test is similar to what I'm currently doing, but would involve loading the elements onto the stack from two different streams and then imploding the whole list. It may not actually be any faster than splitting a list into two pieces and reassembling them, but it's worth a try.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming puzzles: processing lists! - DavidM - 06-12-2017 10:19 PM



User(s) browsing this thread: 1 Guest(s)