GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • rulcode
  • Sign In

This view

  • Original page
  • New address

GeezerVison is showing rulcode.com — Graph DFS Visualizer & Solution | Rulcode

Fetching algorithms...

    Graph DFS Visualizer & Solution | Rulcode
    Loading problem details...

    22. Graph DFS

    Medium
    Topics
    Hint

    Understand Before Coding

    Visualize This Problem
    Open Visualizer
    Draw Your Approach
    Draw

    Example 1:

    Input: graph = [[1, 2], [0, 3], [0, 3], [1, 2]], start = 0
    Output: [0, 1, 3, 2]
    Explanation: Starting from node 0, DFS visits its neighbor 1, then 1's neighbor 3, then backtracks to 0 and visits its neighbor 2.

    Example 2:

    Input: graph = [[1, 2], [0, 2], [0, 1]], start = 1
    Output: [1, 0, 2]
    Explanation: Starting from node 1, DFS visits its neighbor 0, then 0's neighbor 2.

    Example 3:

    Input: graph = [[], [], []], start = 0
    Output: [0]
    Explanation: Node 0 has no neighbors, so DFS only visits node 0.

    Constraints:

    • •
    • •
    • •
    • •

    Time Complexity

    O(V+E)

    Space Complexity

    O(V)

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.