Hi, Well
Recaman's sequence is defined by: a(0) = 0
                                                       a(k) = a(k-1) -
k, k>0, a(k) new term in series or else a(k-1) + k

So sequence is 0, 1, 3,6, 2, 7, 13, 20, 12, 21, 11, 22, 10,
23,............
My approach used memoization using map in c++ (giving O(n) time and
memory for generating sequence), but I somehow feel that there can be
a better approach to check if a term already exists in the sequence.
Any suggestion would be gratefully acknowledged.

Regards,
Tushar

--

You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.


Reply via email to