@anshu mishra:
Hi, kindly clarify on this small doubt of mine.

Your algo is


while (!q.empty())
{
x = q.top();
q.pop();
if(node notvisited already && adjacent to x && value = x)
add to queue
}

For the graph,
1 1 2
1 3 1
2 3 4

first,
queue = 1 (at 0,0)
then you would add the 2 1s at (0,1) and (1,0) to the queue.
So far, i can understand.
now, if you start to pop elements, you ll see that there s no element
with
*equal value as  1* adjacent to the popped elements and the queue
would be
empty.
. How does the algo proceed from here and keep track of count?

.

On May 30, 10:22 am, anshu mishra <[email protected]> wrote:
> @ross no, a particular element has to read only 5 times maximum.
>
> 1 reading (i,j) (if its flag is already false skip)
> 2 read by top element
> 3. read by bottom element
> 4 read by left element
> 5 read by right element
>
> coz atleast one of the this operation its flag will be unset(false), then we
> have to just skip it.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to