Hey,
This is my first time posting. So here I go. In the code below, I have basically used BFS to implement a task. Now, it works for MOST of the inputs, but at very very large inputs i get an error - Segmentation Fault. Now, as far i know it is something to do with memory or buffer overflow(although i dont know what this is), but i cant figure out how to correct it. Any tips would be greatly appreciated.
Well without looking at your code and cause error is segfault I bet it has to do with buffer overflow as you mentioned.
It has to do with your arrays. You are either trying to write to a memory you don't own (like a pointer which in not initialized and points to anything) or in a variety of this case you allocate some memory but exceeds the limits so again trying to access a memory you don't own.
Check you array limits (and you use a lot so good luck)
Hmm eypros, u seem to be right. As it works on the majority of the inputs, I'm guessing there's no problem as far as Accesing memory you don't own goes; this is surely a case of exceeding the allowed memory limit. So to resolve ill have to free some memory and so I'll delete on of the above arrays when I'm done using it. This way I'm might get a solution. Can u tell m a way to do that? (is it even possible?)