You should use BFS because you won't need to use the stack (as DFS does) and you won't get Stack overflow error
On Sunday, May 20, 2012 11:36:30 AM UTC+2, Registered user wrote: > > how do i traverse a 2d matrix of larger dimension ( say 1000x1000 ). i > used dfs that showed correct answer for smaller dimension matrix but > when larger dimension matrix came then error popped up "Stack over > flow .. :( " > -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-code/-/IUXtfNI8P8QJ. 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/google-code?hl=en.
