Programming puzzles: processing lists!
|
04-24-2017, 07:39 PM
Post: #25
|
|||
|
|||
RE: Programming puzzles: processing lists!
(04-22-2017 03:49 PM)pier4r Wrote: Challenge 4 finished and got a strange result... We are essentially doing similar things here, but there's an important difference in the algorithms that makes yours faster. Notice what happens when there's no carry for a given iteration of the list subprogram: your code (nicely) just leaves the list element alone and proceeds. This results in a measurable savings of time for the overall process. It would be interesting to see the results if you change the test input to mostly 1s for each list test. I believe that would bring more parity to the timings between our samples. This underscores an important list processing concept: anything that can be done to minimize the list subprogram for DOLIST/DOSUBS could have a large impact on performance as list sizes increase. And, yes, I (intentionally) did something a bit strange/cryptic with #5 that may not be very obvious. I was curious as to whether anyone would notice. Finally, a suggestion for your consideration: there's no need for you to store the 'value' variable for #4. Your subprogram is fine as-is without it: 1) remove "'value' STO" 2) remove "value" before 0 == 3) remove "ELSE value" Your code will be even faster! |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)