Frontend Knowledge Base
DocumentationsBlogPlayground
Basic
Algorithms
Sorting
Searching
Binary Tree
Graph
BFS(Breadth First Search)DFS(Depth First Search)
Matrix
Design Patterns
Frameworks
Web
Modules
Resources
Frontend Knowledge Base
DocumentationsBlogPlayground
BasicAlgorithmsDesign PatternsFrameworksWebModulesResources
AlgorithmsGraph

DFS(Depth First Search)

const dfs = (node) => {
  if (!node) return;
  console.log(node.val);
  dfs(node.left);
  dfs(node.right);
};

Last updated on

BFS(Breadth First Search)

Previous Page

Matrix

Next Page