Tag: DFS

  • Algorithms 101: PreOrder Traversal

    先序遍历 PreOrder traversal is a tree traversal method where the root node is visited before its children. It is one of the depth-first search (DFS) methods used to explore all the nodes in a tree. In PreOrder traversal, the process is to visit the root node first, then recursively visit…

  • Algorithms 101: DFS and BFS

    Depth-First Search (DFS) and Breadth-First Search (BFS) are two common traversal methods for trees and graphs Tree Traversal Depth-First Search (DFS) is an algorithm that traverses the nodes of a tree by searching the branches as deeply as possible. It traverses the nodes of the tree along its depth, exploring…