Skip to main content

Questions tagged [depth-first-search]

Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some node as the root in the graph case) and explores as far as possible along each branch before backtracking.

1 vote
0 answers
64 views

Intro Still working on PathFinding.java. This time I concentrate on three private methods of GridModel that are responsible for generating random perfect mazes. A maze is perfect if for each two cells ...
coderodde's user avatar
  • 32.3k
1 vote
0 answers
71 views

Intro I have this GitHub repository for doing pathfinding in directed unweighted graphs. This post is about BIDDFS proposed by Richard Korf in his paper. Code ...
coderodde's user avatar
  • 32.3k
1 vote
0 answers
40 views

Intro I have this GitHub repository containing some iterative deepening pathfinding algorithms. Code ...
coderodde's user avatar
  • 32.3k
5 votes
1 answer
363 views

Background I can't seem to find an existing answer solving this doubt of mine. In academic books, it seems that DFS is usually presented in both recursive and iterative forms. The implementations ...
Michel H's user avatar
  • 151
1 vote
1 answer
74 views

I solved this problem: A. Ice Skating, Codeforces My approach was to create grid from given snow drifts coordinates, then convert this grid into graph and then count how many disconnected components ...
Szyszka947's user avatar
6 votes
3 answers
746 views

This program solves the minimum dominating set but it takes an insanely long time to run. In case you do not know, in graph theory, a dominating set for a graph G is a subset D of its vertices, such ...
BeginnerProgrammer6's user avatar
2 votes
1 answer
300 views

I have a rectangle of . (platforms) and # (obstacles). I can start at any platform in the top row and go to the left, right or ...
Aliaksei Badnarchuk's user avatar
1 vote
1 answer
149 views

Let's consider a matrix of integers m: [[1,2,3] [4,5,6] [7,8,9]] Which represents a graph: ...
Gameplay's user avatar
  • 171
2 votes
0 answers
209 views

Motivation Recently, Buzzfeed released a browser-based puzzle game called "Pyramid Scheme." It is available at the following link. The puzzle in an initial state looks like this: To solve ...
WilliamMorris's user avatar
3 votes
1 answer
81 views

I am doing some assignments on my own and one of them is about a Island Counting program, I have come up with a working program but the problem is its very slow. When running test on for example maps ...
phuck's user avatar
  • 33
2 votes
1 answer
150 views

I'm struggling a bit with a USACO silver question using Python: http://usaco.org/index.php?page=viewproblem2&cpid=992. The question provides an unsorted list of numbers (...
Luke's user avatar
  • 21
3 votes
1 answer
158 views

I have been trying to solve Trie related problems over at leet code and came across this interesting problem 211. Design Add and Search Words Data Structure Here is the question for convenience: 211. ...
Shawn Frank's user avatar
1 vote
1 answer
99 views

Part 1/3 Part 3/3 I have this library for performing shortest path queries on dags (directed acyclic graphs). This post presents the shortest path algorithms and the topological sorters. Two ...
coderodde's user avatar
  • 32.3k
1 vote
3 answers
136 views

Assuming I've the following code: ...
Regyn's user avatar
  • 143
0 votes
1 answer
253 views

The following code is applying the depth-first search and breadth-first search algorithm to find the shortest path from bottom left to top right in a 10 x 10 grid. ...
Mohamed Magdy's user avatar

15 30 50 per page
1
2 3 4 5
12