by Tyler on October 22, 2009
by Tyler on April 6, 2008
Today on Ray Myers Blog, (cadr life), he posted about returning lists of n-sized subsequences of a larger list. He used Java and tried to implement the recursive solution that he would normally write in Lisp or Haskell. He also issued a challenge to write this function without recursion. Well, my implementation is certainly not clean, but it is iterative, and is significantly faster for large lists (up to 10x). You can download my Java source file (with a main setup to time my version vs. his recursive version) here.
[click to continue…]