Thanks a lot for ur reply...
ok, I think u had a quick view on my code
(ofcourse who wants to waste time on other's junk when we have our own dying problems
but still some people kind like u reply...
Well I think, these may not be the bugs, ofcourse there is something wrong in my code(or may not
may be judge data is wrong
acctually I have used a different type of binary search( as i m not so good with it
) my last element is list[c-1], there is nothing in list[c] as i m indexing from list not from list. And dont worry about it...because if my bin_s() cant find the match then it will die in the infinite recursion as i kept no termination condition for no found and will cause run time error.
I also checked about finding the last element, and it gets it.
and another part, u know this is a set union problem. i just need some valid indexes to make the set, from bin_s i will get same result for all same input and it will be from 0 to c-1. and plz notic that after i find 'j' and 'k' from bin_s, i shift the value by 1, so 0 become 1, 4 become 5, c-1 become c
, then making set...
Acctually while solving the "friends" problem (up in this volume)which is 100% similar to this one, i had a lot of checks on set-unions,and had to modify my algo about sets. i have also checked in this problem with different values...i m trying to make my own code fool but it is not falling in my trap
i hope people here will give me better traps
ok , now lets talk about ur code......u know, i have little knowledge on hashing(truely i dont understand hashing
), so at first i thought i have no use in ur problem and was going to turn over my eyes from ur code, suddenly something caught my eyes- that is the size of ur arrays.
one big reasons for runtime error is small size of arrays(look how big mine r
) for the name it will take 30 characters, so 31 is ok(i dont trust them
) but there will be <=5000 entries. if u index from 0 its ok, but then be sure that u r doing it everywhere, because if u shift from 1 to c then array will cause crush as there is at max array. I always use array[MAX+1] to avoid such mistakes, u also can try
if u think it will not happen still have a try with some bigger limits of array after u get run time(always),another thing- u use "typedef" before the structure, i use it after. it may work, but may not in some compilers
....i can't help more i dont know how to use hash
thank u for ur reply, plz reply again... and sorry if i wrote something wrong , u know i m a little