Search found 65 matches

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

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; } }
by lonelyone
Thu Apr 12, 2007 7:03 pm
Forum: Volume 100 (10000-10099)
Topic: 10085 - The most distant state
Replies: 10
Views: 3172

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
by lonelyone
Wed Apr 11, 2007 10:52 pm
Forum: Volume 100 (10000-10099)
Topic: 10085 - The most distant state
Replies: 10
Views: 3172

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...
by lonelyone
Sat Jan 06, 2007 11:38 am
Forum: Algorithms
Topic: use Bellman ford algo. to find a negative cycle
Replies: 5
Views: 4043

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.
by lonelyone
Fri Jan 05, 2007 6:55 pm
Forum: Algorithms
Topic: ask two problems
Replies: 2
Views: 1635

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...
by lonelyone
Fri Jan 05, 2007 4:18 pm
Forum: Algorithms
Topic: ask two problems
Replies: 2
Views: 1635

ask two problems

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: ...
by lonelyone
Wed Oct 18, 2006 9:01 am
Forum: Algorithms
Topic: Hanoi Problem
Replies: 1
Views: 1668

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...
by lonelyone
Sat Oct 14, 2006 7:08 pm
Forum: Volume 111 (11100-11199)
Topic: 11125 - Arrange Some Marbles
Replies: 20
Views: 13019

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
by lonelyone
Sun Oct 01, 2006 9:49 pm
Forum: Algorithms
Topic: One question about Tree
Replies: 3
Views: 1999

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
by lonelyone
Sun Oct 01, 2006 9:53 am
Forum: Algorithms
Topic: One question about Tree
Replies: 3
Views: 1999

One question about Tree

Let d1, d2,
by lonelyone
Sun Sep 24, 2006 9:55 am
Forum: Volume 110 (11000-11099)
Topic: 11098 - Battle II
Replies: 11
Views: 5997

any idea to solve this problem?

thanks a lot.
by lonelyone
Thu Aug 24, 2006 9:18 am
Forum: Volume 110 (11000-11099)
Topic: 11052 - Economic phone calls
Replies: 26
Views: 11414

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...
by lonelyone
Sun Aug 13, 2006 10:00 am
Forum: Volume 110 (11000-11099)
Topic: 11069 - A Graph Problem
Replies: 20
Views: 8878

thanks, I think I realized it
by lonelyone
Sun Aug 13, 2006 9:47 am
Forum: Volume 110 (11000-11099)
Topic: 11069 - A Graph Problem
Replies: 20
Views: 8878

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
by lonelyone
Sun Aug 13, 2006 9:42 am
Forum: Volume 110 (11000-11099)
Topic: 11069 - A Graph Problem
Replies: 20
Views: 8878

how about 6 nodes

what's the subsets of it..

could somebody explain problem for me, thanks a lot

Go to advanced search