in reply to Re^2: Puzzle: Given an array of integers, find the best sequence of pop / shift...
in thread Puzzle: Given an array of integers, find the best sequence of pop / shift...

Memoize only reduces the work, it doesn't eliminate checking to see if it's already done.

For N=1000, 2^n ~~ 1e301, while n^2/2 ~~ 1e5. The first will never finish in the lifetime of the universe, the second in a blink of an eye.

-QM
--
Quantum Mechanics: The dreams stuff is made of

  • Comment on Re^3: Puzzle: Given an array of integers, find the best sequence of pop / shift...
  • Download Code