Depth Fist Search and Breadth First Search and using array




I just wonder if for DFS (Depth Fist Search), we don't really need an
array to act as a Stack (LIFO), but we can just use recursion.

Is it true that the main concern is stack overflow? (if too deep
level). If we use the array as a stack, then the overflow problem is
gone. Now, however, if our program is to spider the web, or to go
down the game tree, and we set the levelMax to 10, then the stack
overflow problem is really not there, as the deepest call stack level
is 10.

Is it true that for BFS (Breadth First Search), we always have to use
an array as a Queue (FIFO)? Using an array seems a bit like a "global
variable". Is it possible at all to do BFS without using an array as
a queue and just use recursion?

.



Relevant Pages

  • Re: process subregions on an image/matrix
    ... ARRAY as a stack and pushes the values of LIST onto the end of ARRAY ... You could use traditional methods to remove recursion using a stack. ... either to C or some specialized image processing language. ...
    (comp.lang.perl.misc)
  • Depth Fist Search and Breadth First Search and using array
    ... I just wonder if for DFS (Depth Fist Search), ... array to act as a Stack, but we can just use recursion. ...
    (rec.games.chess.computer)
  • Re: balanced REDUCE: a challenge for the brave
    ... xt execute -> temp ... good place to put the temp values then you could do it easily without recursion. ... With each step you could store the results in the lower half of the array ... No stack depth problems at all. ...
    (comp.lang.forth)
  • Re: I dont understand the definition of DOES>
    ... on stack on code entry). ... You can use DOES to make ARRAY and then use ARRAY ... CREATE CELLS ALLOT ... First you'd make the code that will execute on the child word. ...
    (comp.lang.forth)
  • How to prevent stack overflow?
    ... I'm playing with seed fill algorithm (a.k.a. flood fill). ... get stack overflow. ... question is how do I know how deep the recursion can go in general ... Array of Array of Boolean; ...
    (alt.comp.lang.borland-delphi)