DISHOWN July challenge (Disjoint-set) doubt

c-plus-plus
dishown
disjoint-set
java

#1

Hii
I wrote two solutions one in c++ and one in JAVA Of DISHOWN
All variable names are same ,function names are same ,everything is same

Got AC in C++ :slight_smile: but in JAVA getting NZEC error :frowning: :(. PLz can anyone tell me Why is it so even though both programs are exactly same

C++ solution : http://www.codechef.com/viewsolution/4335936

JAVA solution : http://www.codechef.com/viewsolution/4335995


#2

@n1n1_4 : Are you using recursion in your logic . In Java stack space will exhaust soon and throw “StackOverFlow exception” .


#3

@n1n1_4 : The following link may also be useful to you :

http://discuss.codechef.com/questions/47467/javadoes-recursive-function-posses-some-problem


#4

This answer
3
@n1n1_4 : Are you using recursion in your logic . In Java stack space will exhaust soon and throw “StackOverFlow exception” .

should be in the community wiki. Thanks Vineetpaliwal, you saved my day


#5

@vineetpaliwal thanks i didn’t know this. I was using recursion in java. I appreciate you help. :):):slight_smile: