About 50 results
Open links in new tab
  1. algorithm - How to implement depth first search for graph with a non ...

    Apr 30, 2017 · Recursive DFS uses the call stack to keep state, meaning you do not manage a separate stack yourself. However, for a large graph, recursive DFS (or any recursive function that is) may …

  2. Non-recursive Depth-First Search (DFS) Using a Stack

    Oct 31, 2012 · Non-recursive Depth-First Search (DFS) Using a Stack Asked 13 years, 9 months ago Modified 5 years, 10 months ago Viewed 23k times

  3. Depth First Search on a Binary Tree - Stack Overflow

    Dec 6, 2015 · There are a few options to consider for your DFS algorithm: Firstly, use Backtracking algorithm to do a DFS search. If using Backtracking add only leftChild while traversing downwards. …

  4. Implementing Depth First Search into C# using List and Stack

    Jun 18, 2015 · Implementing Depth First Search into C# using List and Stack Asked 14 years, 10 months ago Modified 6 years, 5 months ago Viewed 57k times

  5. Depth-first search (DFS) code in python - Stack Overflow

    This solution provides a generalized Constraint Satisfaction class that handles both standard grid traversals (BFS/DFS) and complex optimization problems (Backtracking).

  6. Implementing depth-first search using a stack

    Aug 7, 2022 · Traditionally a queue is a FIFO data structure, which is what we want for BFS, whereas a stack is a LIFO data structure, which we want for DFS. But while the name isn't that important, I …

  7. algorithm - DFS and a stack - Stack Overflow

    Mar 11, 2012 · If the graph is traverse using DFS and a stack, starting at vertex a. What would the contents of the queue after every time vertices are inserted to or removed from it be? I'm assuming …

  8. tree - Non-recursive depth first search algorithm - Stack Overflow

    Mar 12, 2011 · I am looking for a non-recursive depth first search algorithm for a non-binary tree. Any help is very much appreciated.

  9. Is implementing a BFS with a stack instead of a queue the same as ...

    Nov 20, 2023 · Would using a stack instead of a queue cause the algorithm to become just a DFS without recursion? I'm thinking that it would, as the LIFO structure of the stack would mean, each …

  10. Use program stack in a DFS implementation

    Nov 12, 2013 · 0 I have a standard DFS implementation in my code that uses a dynamically allocated stack on each call. I call that function a lot. Often on just small runs (200-1000) nodes, but on …