Programming puzzles: processing lists!
|
05-05-2017, 08:40 PM
Post: #74
|
|||
|
|||
RE: Programming puzzles: processing lists!
(05-05-2017 11:51 AM)pier4r Wrote: For the #21 I'm a bit surprised because I did not expect such timings. Your code is longer, but I believe it actually has the potential to be more efficient due to 1 main reason: your use of POS is searching a list that never contains duplicates, whereas Werner's POS is searching the original list (which may contain duplicates). The quantity and position of duplicates can have some bearing on the performance as well. To show the other extreme, an input list with no duplicates removes any "short-circuit" searches that POS might make, and thus negates the advantage yours gains from that. Try the list created by this code to see a different outcome: Code: \<< |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)