Search found 3 matches

by richardxx
Wed Nov 28, 2007 5:59 am
Forum: Algorithms
Topic: K'th Shortest Path
Replies: 6
Views: 4168

I heard that the generalizations of Dijkstra can not handle loopless paths.

But, indeed it solves the loopless form.
Try add the information into the dijkstra label, any time we expand the label according to this visiting information. This can be done with bits operations.

Say:

0110011

We have ...
by richardxx
Fri Oct 20, 2006 5:59 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320000

No one can answer that?

OK, any guy willing to share your code?
Thx.
by richardxx
Fri Oct 20, 2006 7:55 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320000

3n+1 again

I don't know why, I test most cases yet..

#include <stdio.h>
#include <string.h>

int st[1000001];

int work(int org)
{
int cnt=0;
unsigned int start;

start=org;

while (start!=1) {
if (start<org && st[start]!=0) {
cnt+=st[start];
return st[org]=cnt;
}
if (start&0x1)
start=(start<<1 ...

Go to advanced search