Oleg Kobchenko wrote:
>
> But here's a greedy Change:
> http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/Greedy/greedyIntro.htm
>
>    change=: 2 -/\ (] - I. { [)^:([EMAIL PROTECTED])^:a:
>
>    100 25 10 1 change 289
> 100 100 25 25 25 10 1 1 1 1


Thanks, Oleg.  Your formulation is similar to my z, which is slightly
simpler on account of being monadic.  At least I am somewhat along the
right lines.

The representation as Fibonacci numbers is like the change problem.  The
coins are Fibonacci numbers, but you only have one of each.  Requring the
representation to be calculated greedily shows it is unique: more is
needed for existence.  A consequence is that the component Fibonacci
numbers are non-consecutive.

Best wishes,

John


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to