## Search found 65 matches

Tue May 27, 2008 5:09 pm
Forum: Volume 113 (11300-11399)
Topic: 11307 - Alternative Arborescence
Replies: 22
Views: 10803

### Re: 11307 - Alternative Arborescence

Why it got Runtime Error? Could someone explain this for me? Thanks a lot. for(i=0; i<n; ++i) { gets(line); p = line; sscanf(p, "%d%n", &from, &len); p += len; while(*p) { if(sscanf(p, "%d%n", &to, &len) == 1) { v[from].push_back(to); } p += len; } }
Thu Apr 12, 2007 7:03 pm
Forum: Volume 100 (10000-10099)
Topic: 10085 - The most distant state
Replies: 10
Views: 3116

### Re: 8-Puzzle

First of all, thanks for your kindness and response.

I wanna know why in the worst case shortest solution only needs 31 moves.

Can you explain it in some details.

Lonely
Wed Apr 11, 2007 10:52 pm
Forum: Volume 100 (10000-10099)
Topic: 10085 - The most distant state
Replies: 10
Views: 3116

### 8-Puzzle

Hi all: I know there are many algorithm can be used to solve this problem quickly. But somehow I wanna use DFS to solve this problem. Problem Description: Given a board state, I wanna use DFS to find the shortest path from Init state to Goal state(123456780). Obviously, use DFS it should visit all p...
Sat Jan 06, 2007 11:38 am
Forum: Algorithms
Topic: use Bellman ford algo. to find a negative cycle
Replies: 5
Views: 4011

### use Bellman ford algo. to find a negative cycle

How to use Bellman ford algo. to find a negative cycle.
Could someone tell me how to do it.
I mean find the path v1...vk is a negative cycle.
I wanna to find this path.

Thanks a lot.
Fri Jan 05, 2007 6:55 pm
Forum: Algorithms
Replies: 2
Views: 1612
Your first problem is solvable by a modified BFS. Time complexity is O(V+E) (linear). Your second problem can be solved using suffix tree. Thanks for your reply. I think I can think of the solution of first problem. But would you please describe your method(suffix tree) for problem 2 in detail. Use...
Fri Jan 05, 2007 4:18 pm
Forum: Algorithms
Replies: 2
Views: 1612

1. Let G=(V,E) be a directed graph and v and w be two vertices in G. Design a linear-time(O(V^2)) algorithm to find the number of different shortest paths(not necessarily vertex disjoint) between v and w. There are no weights on the edges or you may assume each edge is with weight 1. My thought is: ...
Wed Oct 18, 2006 9:01 am
Forum: Algorithms
Topic: Hanoi Problem
Replies: 1
Views: 1653

### Hanoi Problem

Consider a variation of the towers of Hanoi problem. We no longer assume that all the disks are initially on one peg. They may be arbitrarily distributed among thethree pegs, as long as they are ordered in decreasing sizes on each peg. The purpose of the puzzle remains to move all disks to one speci...
Sat Oct 14, 2006 7:08 pm
Forum: Volume 111 (11100-11199)
Topic: 11125 - Arrange Some Marbles
Replies: 20
Views: 12814

### 11125 - Arrange Some Marbles

I would like to know how to DP it.
I write a Recursive Function; however, I couldn't find a way to memorize
some path.

Any one give me some hint, please.

Lonely
Sun Oct 01, 2006 9:49 pm
Forum: Algorithms
Replies: 3
Views: 1981
First of all, special thanks to Erik.
And in the afternoon of my country, I come up with the same method as yours.
Anyway, I still wanna to thank you.
I also implement it out. ^^
Thanks again.

Lonely
Sun Oct 01, 2006 9:53 am
Forum: Algorithms
Replies: 3
Views: 1981

Let d1, d2,
Sun Sep 24, 2006 9:55 am
Forum: Volume 110 (11000-11099)
Topic: 11098 - Battle II
Replies: 11
Views: 5955
any idea to solve this problem?

thanks a lot.
Thu Aug 24, 2006 9:18 am
Forum: Volume 110 (11000-11099)
Topic: 11052 - Economic phone calls
Replies: 26
Views: 11287
I'm not understand the above input!! Why is 2 the output? You can explain to me? What is wrong in my idea? The years of all the phone calls are as follows: 04:09:06:59 47 - [year 1] (as 04>02) 02:07:05:49 47 + [year 1] (as 02<09) 09:01:03:11 47 - [year 0] (as 09>01) 01:30:02:34 47 - [year 0] (as it...
Sun Aug 13, 2006 10:00 am
Forum: Volume 110 (11000-11099)
Topic: 11069 - A Graph Problem
Replies: 20
Views: 8806
thanks, I think I realized it
Sun Aug 13, 2006 9:47 am
Forum: Volume 110 (11000-11099)
Topic: 11069 - A Graph Problem
Replies: 20
Views: 8806
n=6

{1,3,5}
{2,5}
{1,4,6}
{2,4,6}
{3,6}

am I right?
but why {1,6} can't be included
Sun Aug 13, 2006 9:42 am
Forum: Volume 110 (11000-11099)
Topic: 11069 - A Graph Problem
Replies: 20
Views: 8806