Why do you say the array size isn't bounded by problem statement?
In your code, you want to use the array char in[] to store the word in input,
and it is given that "Each word contains at least two and at most 1000 lowercase characters". http://appsrv.cse.cuhk.edu.hk/~csc1140/ ... _tuto2.ppt
Read page 8 again!!! You will know what the size of array char in[] should be.
In the code you have posted, I think there is no more bug. So you are making mistake in the remaining code. As I see your code you have posted, I can guess that you may make more mistake about array bound in the remaining code......
P.S. Don't you know that typing in full captial letters is impolite?
My signature:
Please make discussion about the algorithm BRFORE posting source code.
We can learn much more in discussion than reading source code.
>P.S. Don't you know that typing in full captial letters is impolite?
I DONT KNOW
WHY?
Well.....I can't find any reference about that, but it is a commonly known "web manner".
Write a word/sentence in captial means you want to emphasize the meaning of it. But writing the whole message in captial means you are shouting at me....
My signature:
Please make discussion about the algorithm BRFORE posting source code.
We can learn much more in discussion than reading source code.
if I understand corerctly I have to make a graph of all the 26 letters and then add a directed edge between the first letter and last letter of each word and then check for an eulerian path? is this correct.
also, i know how to check an eulerian path in an undirected graph but how do i do it in a directed graph? i know i have to check if it is strongly connected but how do i do that?
I badly need some input-output for the problem PLAY on WORDS its a simple Euler path problem but i cant do anything unless i experience some critical input and output.
tuman wrote:I badly need some input-output for the problem PLAY on WORDS its a simple Euler path problem but i cant do anything unless i experience some critical input and output.
Try This:
Input:
2
4
ad
da
pq
qp
4
ad
da
ad
da
Output:
The door cannot be opened.
Ordering is possible.
critical i/0
9
2
acm
ibm
3
acm
malform
mouse
2
ok
ok
3
ab
bc
ca
3
ab
bc
cb
1
ab
2
ab
bc
4
ab
ba
ab
ba
4
ab
ba
cd
dc
Output
The door cannot be opened.
Ordering is possible.
The door cannot be opened.
Ordering is possible.
Ordering is possible.
Ordering is possible.
Ordering is possible.
Ordering is possible.
The door cannot be opened.
I have submitted the problem for many times, but always get wrong answer. I have tested all the inputs which i have found in board and my program is ok for all given inputs. I can't find any wrong with my code. Please help me by locating errors.