this may help you to tackle the problem.
http://mathworld.wolfram.com/CollatzProblem.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
I think O(klogk) is possible.
array1=A={a1,a2,...,},B=arrary2={b1,b2,..}
think about the 2-d grid generated by A,B ( all points (ai,bj)).
using a swap line x+y=c, swap these point until we have scaned k point.
maintain a heap to tell which point will be the next point we will
scan.
Moreover, if
your problem is a typical NPcomplete problem
and no polynomial algorithm is possible.
the link you provide just calculates maximal independent set, not
maximum independent set. It turns out this two can be totally
different.
Ken1 wrote:
I've been trying to do this for a while and now I give up,