Tagged articles
DFS
18 articles · Page 1 of 1
This article explains how to implement breadth‑first (BFS) and depth‑first (DFS) traversals—including level‑order, preorder, inorder, and postorder—on a binary tree in Java 17, covering both recursive and iterative approaches, performance considerations, and a lazy Iterable wrapper.
BFSDFSJava 17
0 likes · 22 min read

The article systematically explains the most common algorithms—search, sorting, two‑pointer, hash, recursion, graph traversal, greedy and dynamic programming—detailing their principles, typical use cases, real‑world code examples, and practical advice for when to apply or avoid them in everyday software development.
AlgorithmsBFSDFS
0 likes · 15 min read

This article introduces LeetCode problem 1448 about counting good nodes in a binary tree, explains the definition of a good node, provides example inputs and outputs, outlines constraints, offers a detailed DFS analysis, and presents complete Java and C++ implementations.
AlgorithmC++DFS
0 likes · 5 min read

The article explains LeetCode 491, requiring all non‑decreasing subsequences of length ≥2 from an integer array, and details a depth‑first search approach that uses a per‑level set to skip duplicates, with complete example implementations in Java, C++, C, and Python.
C++DFSJava
0 likes · 7 min read

This article presents LeetCode problem 797, which asks for all possible paths from node 0 to node n‑1 in a directed acyclic graph, explains the DFS approach, lists constraints and examples, and provides complete implementations in Java, C++, C, and Python.
AlgorithmC++DFS
0 likes · 8 min read

This article explains LeetCode problem 124, describing the definition of a path in a binary tree, analyzing the constraints, and providing a detailed Java implementation that uses depth‑first search to compute the maximum path sum while handling negative sub‑paths.
AlgorithmDFSJava
0 likes · 5 min read

This article explains how to determine the maximum number of Linux distributions in a connected group by modeling the relationships as an adjacency matrix and applying BFS or DFS to count the largest connected component, with full Python implementations and complexity analysis.
AlgorithmBFSDFS
0 likes · 7 min read

Given an N×N adjacency matrix representing direct connections among N servers, the task is to determine the minimum number of servers that must initiate a broadcast so every server receives the message, with solutions using BFS or DFS to count connected components and detailed Python implementations plus time‑space analysis.
BFSDFSGraph
0 likes · 6 min read

This article explains the 2023Q1A "Happy Elimination" problem, where a binary matrix must be turned all zeros by clicking cells that toggle themselves and their eight neighbors, and shows how to compute the minimum number of clicks with BFS or DFS counting connected components.
BFSDFSGrid
0 likes · 9 min read

This article explains the 2023B problem of locating the maximum‑value mine cluster on a grid of '0', '1', and '2' cells, provides BFS and DFS solutions in Python, and details input format, examples, and time‑space complexity.
AlgorithmBFSDFS
0 likes · 8 min read

This article introduces the basic concepts of graphs, including vertices, edges, directed and undirected types, explains common storage methods such as adjacency matrices and adjacency lists with examples, and demonstrates graph traversal techniques like depth‑first and breadth‑first search using Java code.
Adjacency ListBFSDFS
0 likes · 6 min read

This article explains the classic "Number of Islands" problem, presents two example grids, and demonstrates how depth‑first search (DFS) and breadth‑first search (BFS) can be applied to count isolated land masses in a 2D matrix.
BFSDFSgraph traversal
0 likes · 6 min read

This article explains the concept of full permutations, presents a classic interview problem requiring all permutations of a distinct integer array, and walks through a backtracking solution in Java with detailed step‑by‑step analysis and code examples.
AlgorithmDFSJava
0 likes · 6 min read

Given an array where each element indicates the maximum jump length from that position, this article explores multiple strategies—depth‑first search, dynamic programming, greedy, and reverse‑tracking—to determine whether the frog can reach the last board, comparing their efficiency and implementation details.
AlgorithmDFSdynamic programming
0 likes · 7 min read

This article explains how to enumerate every permutation of an array using a depth‑first search backtracking algorithm, illustrates the process with a tree diagram, compares DFS with BFS, and provides a complete C implementation along with a generic Python template.
AlgorithmC++DFS
0 likes · 7 min read

This article explains the binary‑tree maximum path sum problem, provides example inputs and outputs, analyzes three possible path configurations, and presents both a brute‑force and an optimized depth‑first search implementation in C.
AlgorithmC++DFS
0 likes · 5 min read

This article explains the symmetric‑tree problem, outlines a depth‑first recursive strategy with base‑case checks, demonstrates short‑circuit evaluation, analyzes time complexity, and provides a complete Java implementation that determines tree symmetry in linear time.
AlgorithmDFSJava
0 likes · 3 min read


21CTOOct 21, 2015 · Fundamentals
This article explains how graph traversal algorithms like BFS and DFS underpin web crawlers, illustrating the concepts with examples from China's road network and tracing the history from Euler's bridges to modern internet indexing.
BFSDFSWeb Crawling
0 likes · 6 min read
