Tagged articles
binary tree
28 articles · Page 1 of 1
This article explains binary tree representation in Java and demonstrates recursive pre-order, in-order, post-order, and iterative level-order traversals, plus methods to create a full binary tree, count nodes, compute height, and count leaf nodes with complete runnable code.
AlgorithmJavaQueue
0 likes · 9 min read


liandkSep 2, 2026 · Fundamentals
This article introduces binary trees, explains key terminology and four common tree shapes, details four traversal methods, provides a complete Python implementation with sample output, and highlights real‑world uses and beginner pitfalls.
Pythonbinary treedata structures
0 likes · 7 min read

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

Beyond the hype of counting code lines, this article explores why quality matters and presents a classic interview problem—finding the second‑strongest contestant in a knockout tournament—using a binary‑tree simulation with a concise Java implementation that runs in optimal time.
AlgorithmInterviewJava
0 likes · 6 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

This article explains the concept of pre-order (root-left-right) tree traversal, demonstrates how to represent binary trees in PHP, provides recursive and stack‑based iterative implementations, and includes an interactive script that lets users build a tree and choose traversal methods, with full example code.
AlgorithmPHPPre-order
0 likes · 9 min read

The article explains LeetCode 814, where a binary tree of 0s and 1s is pruned by recursively removing subtrees lacking a 1, using a post‑order traversal that returns null for nodes with value 0 and no retained children, achieving O(n) time and O(h) space.
AlgorithmC++Java
0 likes · 6 min read

This article explains the segment tree data structure, showing how to build it both bottom‑up and recursively, how node indexing works, and how the query algorithm skips irrelevant intervals to compute range sums in logarithmic time, complete with Python code examples and performance tips.
Pythonbinary treebottom‑up construction
0 likes · 18 min read

The article first shares a frustrated JD interview experience regarding a 'personality' assessment, then introduces LeetCode problem 814 – Binary Tree Pruning – detailing the problem statement, examples, and providing concise post‑order traversal solutions in Java, C++, and Python.
C++JavaLeetCode
0 likes · 6 min read

The article humorously discusses Huawei cafeteria competition before presenting LeetCode problem 102, which requires a breadth‑first level order traversal of a binary tree, and provides complete Java, C++, C, and Python implementations that use a queue to process each tree level.
AlgorithmBFSC++
0 likes · 7 min read

This article reviews binary tree traversal methods, clarifies the correct postorder sequence, and provides Morris traversal implementations in C++, C, and Python, while also discussing common interview misconceptions and offering illustrative examples.
AlgorithmC++C++
0 likes · 8 min read

This article introduces binary trees, explains their Java representation, demonstrates pre-order, in-order, post-order, and level-order traversals, and provides implementations for creating full binary trees, counting nodes, computing height, and counting leaf nodes, complete with sample code and usage examples.
AlgorithmJavabinary tree
0 likes · 10 min read

The article explains how to obtain the rightmost node values at each depth of a binary tree by performing a level‑order (BFS) traversal, and provides a complete Go implementation that records the last node of every level as the right‑side view.
AlgorithmBFSGo
0 likes · 4 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 the concepts of binary trees, complete binary trees, and binary heaps, shows how React implements a min‑heap for its task scheduler, and provides detailed JavaScript code examples for push, pop, siftUp, siftDown, and peek operations.
AlgorithmJavaScriptReact
0 likes · 10 min read

This article presents three algorithmic challenges: counting pattern occurrences on an M×N canvas, determining the number of leaf nodes in a binary tree represented by an array, and maximizing stock trade profit under constraints on negative returns and total gain, each with input specifications, sample cases, and solution outlines.
Algorithmbinary treeconstraints
0 likes · 8 min read

This comprehensive guide explains core data concepts, defines data, data objects, elements and types, explores logical and physical structures, details sequential, linked, indexed and hash storage, and provides Java code examples for arrays, linked lists, stacks, queues, trees, binary search trees, AVL and red‑black trees, illustrating how to choose and implement appropriate structures for real‑world problems.
AlgorithmsJavaQueue
0 likes · 24 min read

This article explains the fundamentals of tree data structures—including general trees, binary trees, AVL balanced trees, and red‑black trees—covering their definitions, node types, properties, rotation techniques, and insertion and deletion algorithms with illustrative code examples.
AlgorithmsRed-Black Treebinary tree
0 likes · 17 min read

This article uses the occasion of Tree‑Planting Day to explain binary trees in simple terms, covering their definition, node types, degree, levels, five tree shapes, traversal methods (pre‑order, in‑order, post‑order, level‑order), advantages, drawbacks, and a brief comparison with binary search.
Algorithmbinary treefundamentals
0 likes · 9 min read

This article compiles a comprehensive list of over 400 algorithm and data‑structure problem solutions—including dynamic programming, backtracking, DFS/BFS, binary‑tree, linked‑list, stack, sorting, searching and classic puzzles—organized by topic and linked to detailed explanations for easy reference.
Algorithmsbacktrackingbinary tree
0 likes · 9 min read

This article explains the concepts, properties, and operations of binary trees, binary search trees, AVL trees, 2‑3 and 2‑3‑4 trees, B‑trees, and red‑black trees, illustrating how they maintain balance, avoid degeneration, and are applied in modern software systems.
AVL TreeB-treeRed-Black Tree
0 likes · 10 min read

This article provides a comprehensive introduction to fundamental data structures, core algorithm concepts, and classic sorting techniques, explaining their definitions, basic operations, time and space complexities, stability considerations, and practical use cases for developers seeking to strengthen their programming foundations.
AlgorithmsComplexitybinary tree
0 likes · 20 min read

This article provides a detailed overview of binary trees, covering their definition, traversal methods, various types such as full, complete, BST, and AVL trees, along with their characteristics, advantages, disadvantages, and time‑complexity considerations for Java developers.
AVLAlgorithmsBST
0 likes · 7 min read

This article compiles a wide range of typical binary tree interview problems—including judgment, construction, storage, search, distance, and mixed challenges—provides detailed explanations, multiple solution approaches, and complete C code implementations for each, serving as a thorough study guide for interview preparation.
Interview questionsbinary treec-programming
0 likes · 30 min read


JavaEdgeJan 3, 2020 · Interview Experience
This article explains how to determine whether a binary tree contains a root‑to‑leaf path whose node values sum to a given target, outlines the recursive subtraction method, and provides a complete C implementation of the algorithm.
AlgorithmInterviewbinary tree
0 likes · 2 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 concept of recursion, presents a universal four‑step solving method, and walks through multiple practical examples—from factorials and frog‑jump problems to binary‑tree inversion, Tower of Hanoi, and cellular division—while detailing time and space complexity analyses and optimization strategies.
binary treedynamic programmingrecursion
0 likes · 22 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
