DSA question set · 200 questions
Binary Tree DSA Practice Questions
Explore 200 DSA questions in Binary Tree. Practice with DSAWiser’s code editor and visualizer.
Binary treeCreate a Single Tree NodeValue of Root NodeCheck if Tree is EmptyCheck if Root is a LeafGet Left Child ValueGet Right Child ValueCount Children of RootCheck if Root Has Both ChildrenCheck if Root Has Exactly One ChildSum of Root and Immediate ChildrenCompare Root with Left ChildCompare Root with Right ChildDifference Between Children ValuesSwap Immediate Children of RootCheck if Tree Has Exactly One NodeCheck if Root is an Internal NodeMaximum of Root and Direct ChildrenMinimum of Root and Direct ChildrenCheck if Root Has Left Child OnlyCheck if Root Has Right Child OnlyGet Values of GrandchildrenCount Nodes up to Depth 1Height of a Small Tree (Depth at most 1)Check if Children Have Equal ValuesCheck if Root Value is Average of ChildrenPreorder Traversal of a Tree of Depth at most 1Inorder Traversal of a Tree of Depth at most 1Postorder Traversal of a Tree of Depth at most 1Check if Root is Greater than Both ChildrenCheck if Root is Smaller than Both ChildrenCheck Local BST Property at RootSum of Left Spine up to Depth 2Sum of Right Spine up to Depth 2Check if Left Child is a LeafCheck Parity of Root Node ValueCheck if Right Child is a LeafCount Direct Children That Are LeavesCheck if Root Equals Sum of ChildrenProduct of Root and Direct ChildrenReset Root Value to ZeroPrune Left Subtree at RootPrune Right Subtree at RootCreate a Two-Node Tree (Left Child)Create a Two-Node Tree (Right Child)Compare Left and Right Child ValuesCreate a Three-Node TreeCheck if Any Direct Child Has Negative ValueAbsolute Difference with Left ChildAbsolute Difference with Right ChildCheck if Tree Has No Left ChildMaximum depth DFS/BFSPreorder traversalInorder traversalPostorder traversalNode-count aggregationSubtree sum aggregationRecursive mirror mutationStructural equalityMirror symmetryNearest leaf / BFSLeaf countingValue maximum aggregationValue minimum aggregationBSTOrdered searchUniform-value predicateRoot-to-leaf sum existencePairwise recursive mergeLeaf-sequence comparisonPruned range sumOriented-leaf aggregationEnumerate root-to-leaf pathsExpression-tree evaluationDepth/parent cousin comparisonLevel average BFSSpecial full/min-child treeOrdered LCADistinct-node two-sumInorder adjacent differenceInorder frequency modesStructural subtree searchCanonical parenthesis encodingClone-correspondence identityBinary root-to-leaf numeral aggregationFull-tree shape predicateDegenerate-tree shape predicateFiltered node countingPreorder target search with depthUniform leaf-depth predicateFlat BFS orderSingle-child countingExact root-to-leaf node countSibling lookupParent lookupGeneral-tree-value range countParent-child order predicateGrouped level-order traversalRight view BFSPath-maximum node predicateDeepest-level aggregationComplete-layout BFS predicateBottom-left BFS valuePer-level maximaMaximum level sum with earliest tiePostorder height/balance invariantPostorder diameter invariantPostorder subtree sums and tiltBalanced construction from sorted keysInorder structural rewriteGeneral-tree LCA via binary childrenAlternating level traversalGlobal key bounds validationPreorder/inorder reconstructionInorder/postorder reconstructionPreorder flattening in placeCross-level next pointersEnumerate target-sum pathsDownward-prefix path countingInorder order statisticComplete-tree count below linear timeIndependent-set tree DPBST deletion and successor/predecessorBST leaf insertion / alternative shapeOrder-preserving range trimmingParent-aware distance BFSComplete-slot width indicesCanonical subtree interningPostorder coin balanceLCA of deepest leavesPath min/max ancestor differenceRoot-leaf parity masksLazy inorder stack iteratorBST combinatoricsCatalan-number DPSwapped-key recoveryDecimal path numeral sumPostorder sum frequencyDepth-row structural insertionRecursive leaf deletion to fixed pointSubtree sum/count averageInfection / eccentricity from one nodeAlternating-edge path DPPostorder existence pruningFlip-invariant structural equivalenceImplicit binary treeArithmetic path in implicit labelsBounded leaf-distance histogramsLCA plus directional pathsOutput-sensitive tree layoutEnumerate Catalan familyInorder rebuilding / balanced search treeAuxiliary binary treeMaximum Cartesian constructionLevel parity/order verificationBoundary walk with leaf deduplicationImplicit-label LCA cycle distanceGeneral treeLongest label-compatible path DPLeaf-restricted maximum path DPVoyage matching / minimum flipsBurning / eccentricity from one nodeMorris traversal / restoration labBinary tree with random pointersIdentity-preserving graph copySubtree-size centroid selectionAny-endpoint maximum path DPSerialization/deserialization APIThree-state camera greedy / DPCoordinate ordering with value tiesPreorder depth parser reconstructionAll-node distance rerootingBST subtree summary DPBST insertion-order combinatoricsOutside-subtree height queriesGuessed-edge orientation rerootingLeaf grafting with global BST boundsValue-threshold union-find pathsConnected-subset diameter enumerationTwo-edge cuts / component XORWeighted path rerootingTrip path frequencies + independent-set DPPrime/nonprime path component countingDiameter/center merge optimizationBinary-lifting ancestor data structureAncestor XOR trie with rollbackBST subtree size summary DPPersistent frequencies + LCA kth pathOffline distinct-color path queriesDSU-on-tree frequency thresholdsHeavy-light path/subtree lazy updatesCentroid exact-length pair countsAncestor-dependent DFS-order knapsackUnrooted canonical tree isomorphismNode-XOR path countingOutside-subtree diameter rerootingRadius domination greedy / DPInsertion-only diameter endpoints / LCAImplicit treap split/merge/reversalCut-budget component selectionVirtual-tree minimum separating cutLink-cut dynamic forestDynamic max-plus independent-set DPCartesian tree + optimal static RMQCentroid distance convolutionDynamic path order statisticsBounded-diameter connected-subset counting
What’s in this set
The Binary Tree collection contains 200 problems: 50 basic, 53 easy, 56 medium, 34 hard, 7 very hard. Choose a question at your current level, or follow the collection’s order below.
Topics in this collection include Binary tree, Create a Single Tree Node, Value of Root Node, Check if Tree is Empty, Check if Root is a Leaf. Each question shows its own topics and difficulty so you can decide where to begin.
Practice with the code visualizer
- Open a question in the editor and read the statement, inputs, and expected output. Predict the result for a small example before writing code.
- Write a solution and run the examples. If a result differs from your prediction, reduce the input until you can follow each step.
- Step through your code in the visualizer. Use a breakpoint to inspect the state at a specific line, then compare it with your reasoning.
Questions in this set
200 totalOpen a question in the editor to read its statement and examples. Sign in to practice.
- Create a Single Tree NodeBinary tree · Create a Single Tree NodeBasic
- Value of Root NodeBinary tree · Value of Root NodeBasic
- Check if Tree is EmptyBinary tree · Check if Tree is EmptyBasic
- Check if Root is a LeafBinary tree · Check if Root is a LeafBasic
- Get Left Child ValueBinary tree · Get Left Child ValueBasic
- Get Right Child ValueBinary tree · Get Right Child ValueBasic
- Count Children of RootBinary tree · Count Children of RootBasic
- Check if Root Has Both ChildrenBinary tree · Check if Root Has Both ChildrenBasic
- Check if Root Has Exactly One ChildBinary tree · Check if Root Has Exactly One ChildBasic
- Sum of Root and Immediate ChildrenBinary tree · Sum of Root and Immediate ChildrenBasic
- Compare Root with Left ChildBinary tree · Compare Root with Left ChildBasic
- Compare Root with Right ChildBinary tree · Compare Root with Right ChildBasic
- Difference Between Children ValuesBinary tree · Difference Between Children ValuesBasic
- Swap Immediate Children of RootBinary tree · Swap Immediate Children of RootBasic
- Check if Tree Has Exactly One NodeBinary tree · Check if Tree Has Exactly One NodeBasic
- Check if Root is an Internal NodeBinary tree · Check if Root is an Internal NodeBasic
- Maximum of Root and Direct ChildrenBinary tree · Maximum of Root and Direct ChildrenBasic
- Minimum of Root and Direct ChildrenBinary tree · Minimum of Root and Direct ChildrenBasic
- Check if Root Has Left Child OnlyBinary tree · Check if Root Has Left Child OnlyBasic
- Check if Root Has Right Child OnlyBinary tree · Check if Root Has Right Child OnlyBasic
- Get Values of GrandchildrenBinary tree · Get Values of GrandchildrenBasic
- Count Nodes up to Depth 1Binary tree · Count Nodes up to Depth 1Basic
- Height of a Small Tree (Depth at most 1)Binary tree · Height of a Small Tree (Depth at most 1)Basic
- Check if Children Have Equal ValuesBinary tree · Check if Children Have Equal ValuesBasic
- Check if Root Value is Average of ChildrenBinary tree · Check if Root Value is Average of ChildrenBasic
- Preorder Traversal of a Tree of Depth at most 1Binary tree · Preorder Traversal of a Tree of Depth at most 1Basic
- Inorder Traversal of a Tree of Depth at most 1Binary tree · Inorder Traversal of a Tree of Depth at most 1Basic
- Postorder Traversal of a Tree of Depth at most 1Binary tree · Postorder Traversal of a Tree of Depth at most 1Basic
- Check if Root is Greater than Both ChildrenBinary tree · Check if Root is Greater than Both ChildrenBasic
- Check if Root is Smaller than Both ChildrenBinary tree · Check if Root is Smaller than Both ChildrenBasic
- Check Local BST Property at RootBinary tree · Check Local BST Property at RootBasic
- Sum of Left Spine up to Depth 2Binary tree · Sum of Left Spine up to Depth 2Basic
- Sum of Right Spine up to Depth 2Binary tree · Sum of Right Spine up to Depth 2Basic
- Check if Left Child is a LeafBinary tree · Check if Left Child is a LeafBasic
- Check Parity of Root Node ValueBinary tree · Check Parity of Root Node ValueBasic
- Check if Right Child is a LeafBinary tree · Check if Right Child is a LeafBasic
- Count Direct Children That Are LeavesBinary tree · Count Direct Children That Are LeavesBasic
- Check if Root Equals Sum of ChildrenBinary tree · Check if Root Equals Sum of ChildrenBasic
- Product of Root and Direct ChildrenBinary tree · Product of Root and Direct ChildrenBasic
- Reset Root Value to ZeroBinary tree · Reset Root Value to ZeroBasic
- Prune Left Subtree at RootBinary tree · Prune Left Subtree at RootBasic
- Prune Right Subtree at RootBinary tree · Prune Right Subtree at RootBasic
- Create a Two-Node Tree (Left Child)Binary tree · Create a Two-Node Tree (Left Child)Basic
- Create a Two-Node Tree (Right Child)Binary tree · Create a Two-Node Tree (Right Child)Basic
- Compare Left and Right Child ValuesBinary tree · Compare Left and Right Child ValuesBasic
- Create a Three-Node TreeBinary tree · Create a Three-Node TreeBasic
- Check if Any Direct Child Has Negative ValueBinary tree · Check if Any Direct Child Has Negative ValueBasic
- Absolute Difference with Left ChildBinary tree · Absolute Difference with Left ChildBasic
- Absolute Difference with Right ChildBinary tree · Absolute Difference with Right ChildBasic
- Check if Tree Has No Left ChildBinary tree · Check if Tree Has No Left ChildBasic
- Maximum Depth of Binary TreeBinary tree · Maximum depth DFS/BFSEasy
- Binary Tree Preorder TraversalBinary tree · Preorder traversalEasy
- Binary Tree Inorder TraversalBinary tree · Inorder traversalEasy
- Binary Tree Postorder TraversalBinary tree · Postorder traversalEasy
- Count Total NodesBinary tree · Node-count aggregationEasy
- Sum of All Node ValuesBinary tree · Subtree sum aggregationEasy
- Invert Binary TreeBinary tree · Recursive mirror mutationEasy
- Same TreeBinary tree · Structural equalityEasy
- Symmetric TreeBinary tree · Mirror symmetryEasy
- Minimum Depth of Binary TreeBinary tree · Nearest leaf / BFSEasy
- Count Leaf NodesBinary tree · Leaf countingEasy
- Find Maximum Value in Binary TreeBinary tree · Value maximum aggregationEasy
- Find Minimum Value in Binary TreeBinary tree · Value minimum aggregationEasy
- Search in a Binary Search TreeBST · Ordered searchEasy
- Univalued Binary TreeBinary tree · Uniform-value predicateEasy
- Path SumBinary tree · Root-to-leaf sum existenceEasy
- Merge Two Binary TreesBinary tree · Pairwise recursive mergeEasy
- Leaf-Similar TreesBinary tree · Leaf-sequence comparisonEasy
- Range Sum of BSTBST · Pruned range sumEasy
- Sum of Left LeavesBinary tree · Oriented-leaf aggregationEasy
- Binary Tree PathsBinary tree · Enumerate root-to-leaf pathsEasy
- Evaluate Boolean Binary TreeBinary tree · Expression-tree evaluationEasy
- Cousins in Binary TreeBinary tree · Depth/parent cousin comparisonEasy
- Average of Binary Tree Levels as Fixed DecimalsBinary tree · Level average BFSEasy
- Second Minimum Node In a Binary TreeBinary tree · Special full/min-child treeEasy
- Lowest Common Ancestor of a Binary Search TreeBST · Ordered LCAEasy
- Two Sum IV - Input is a BSTBST · Distinct-node two-sumEasy
- Minimum Absolute Difference in BSTBST · Inorder adjacent differenceEasy
- Find Mode in Binary Search TreeBST · Inorder frequency modesEasy
- Subtree of Another TreeBinary tree · Structural subtree searchEasy
- Construct String from Binary TreeBinary tree · Canonical parenthesis encodingEasy
- Find Corresponding Node Index in a Cloned TreeBinary tree · Clone-correspondence identityEasy
- Sum of Root To Leaf Binary NumbersBinary tree · Binary root-to-leaf numeral aggregationEasy
- Check if Binary Tree is FullBinary tree · Full-tree shape predicateEasy
- Check if Binary Tree is SkewedBinary tree · Degenerate-tree shape predicateEasy
- Count Nodes with Even ValuesBinary tree · Filtered node countingEasy
- Find Depth of Target NodeBinary tree · Preorder target search with depthEasy
- Check if All Leaves are at Same LevelBinary tree · Uniform leaf-depth predicateEasy
- Level Order Traversal (Flat Array)Binary tree · Flat BFS orderEasy
- Count Single-Child NodesBinary tree · Single-child countingEasy
- Root-to-Leaf Path of Given LengthBinary tree · Exact root-to-leaf node countEasy
- Find Sibling of a NodeBinary tree · Sibling lookupEasy
- Find Parent of a NodeBinary tree · Parent lookupEasy
- Count Nodes within Range in Binary TreeBinary tree · General-tree-value range countEasy
- Check if All Paths are Strictly IncreasingBinary tree · Parent-child order predicateEasy
- Binary Tree Level Order TraversalBinary tree · Grouped level-order traversalEasy
- Binary Tree Right Side ViewBinary tree · Right view BFSEasy
- Count Good Nodes in Binary TreeBinary tree · Path-maximum node predicateEasy
- Deepest Leaves SumBinary tree · Deepest-level aggregationEasy
- Check Completeness of a Binary TreeBinary tree · Complete-layout BFS predicateEasy
- Find Bottom Left Tree ValueBinary tree · Bottom-left BFS valueEasy
- Find Largest Value in Each Tree RowBinary tree · Per-level maximaEasy
- Maximum Level Sum of a Binary TreeBinary tree · Maximum level sum with earliest tieEasy
- Balanced Binary TreeBinary tree · Postorder height/balance invariantMedium
- Diameter of Binary TreeBinary tree · Postorder diameter invariantMedium
- Binary Tree TiltBinary tree · Postorder subtree sums and tiltMedium
- Convert Sorted Array to Binary Search TreeBST · Balanced construction from sorted keysMedium
- Increasing Order Search TreeBST · Inorder structural rewriteMedium
- Lowest Common Ancestor of a Binary TreeBinary tree · General-tree LCA via binary childrenMedium
- Binary Tree Zigzag Level Order TraversalBinary tree · Alternating level traversalMedium
- Validate Binary Search TreeBST · Global key bounds validationMedium
- Construct Binary Tree from Preorder and Inorder TraversalBinary tree · Preorder/inorder reconstructionMedium
- Construct Binary Tree from Inorder and Postorder TraversalBinary tree · Inorder/postorder reconstructionMedium
- Flatten Binary Tree to Linked ListBinary tree · Preorder flattening in placeMedium
- Next-Right Links by Binary Tree Node IndexBinary tree · Cross-level next pointersMedium
- Path Sum IIBinary tree · Enumerate target-sum pathsMedium
- Path Sum IIIBinary tree · Downward-prefix path countingMedium
- Kth Smallest Element in a BSTBST · Inorder order statisticMedium
- Count Complete Tree NodesBinary tree · Complete-tree count below linear timeMedium
- House Robber IIIBinary tree · Independent-set tree DPMedium
- Delete Node in a BSTBST · BST deletion and successor/predecessorMedium
- Insert into a Binary Search TreeBST · BST leaf insertion / alternative shapeMedium
- Trim a Binary Search TreeBST · Order-preserving range trimmingMedium
- All Nodes Distance K in Binary TreeBinary tree · Parent-aware distance BFSMedium
- Maximum Width of Binary TreeBinary tree · Complete-slot width indicesMedium
- Find Duplicate SubtreesBinary tree · Canonical subtree interningMedium
- Distribute Coins in Binary TreeBinary tree · Postorder coin balanceMedium
- Smallest Subtree with all the Deepest NodesBinary tree · LCA of deepest leavesMedium
- Maximum Difference Between Node and AncestorBinary tree · Path min/max ancestor differenceMedium
- Pseudo-Palindromic Paths in a Binary TreeBinary tree · Root-leaf parity masksMedium
- Binary Search Tree IteratorBST · Lazy inorder stack iteratorMedium
- Unique Binary Search TreesBST combinatorics · Catalan-number DPMedium
- Recover Binary Search TreeBST · Swapped-key recoveryMedium
- Sum Root to Leaf NumbersBinary tree · Decimal path numeral sumMedium
- Most Frequent Subtree SumBinary tree · Postorder sum frequencyMedium
- Add One Row to TreeBinary tree · Depth-row structural insertionMedium
- Delete Leaves With a Given ValueBinary tree · Recursive leaf deletion to fixed pointMedium
- Count Nodes Equal to Average of SubtreeBinary tree · Subtree sum/count averageMedium
- Amount of Time for Binary Tree to Be InfectedBinary tree · Infection / eccentricity from one nodeMedium
- Longest ZigZag Path in a Binary TreeBinary tree · Alternating-edge path DPMedium
- Binary Tree PruningBinary tree · Postorder existence pruningMedium
- Flip Equivalent Binary TreesBinary tree · Flip-invariant structural equivalenceMedium
- Path In Zigzag Labelled Binary TreeImplicit binary tree · Arithmetic path in implicit labelsMedium
- Number of Good Leaf Nodes PairsBinary tree · Bounded leaf-distance histogramsMedium
- Step-By-Step Directions From a Binary Tree Node to AnotherBinary tree · LCA plus directional pathsMedium
- Print Binary TreeBinary tree · Output-sensitive tree layoutMedium
- Unique Binary Search Trees IIBST combinatorics · Enumerate Catalan familyMedium
- Balance a Binary Search TreeBST · Inorder rebuilding / balanced search treeMedium
- Maximum Binary TreeAuxiliary binary tree · Maximum Cartesian constructionMedium
- Even Odd TreeBinary tree · Level parity/order verificationMedium
- Boundary Traversal of Binary TreeBinary tree · Boundary walk with leaf deduplicationMedium
- Cycle Length Queries in a TreeImplicit binary tree · Implicit-label LCA cycle distanceMedium
- Longest Path With Different Adjacent CharactersGeneral tree · Longest label-compatible path DPMedium
- Maximum Path Sum Between Two LeavesBinary tree · Leaf-restricted maximum path DPMedium
- Flip Binary Tree To Match Preorder TraversalBinary tree · Voyage matching / minimum flipsMedium
- Burning Tree from Target NodeBinary tree · Burning / eccentricity from one nodeMedium
- Morris Inorder TraversalBinary tree · Morris traversal / restoration labMedium
- Reindex a Binary Tree with Random LinksBinary tree with random pointers · Identity-preserving graph copyMedium
- Tree Centroid FindingGeneral tree · Subtree-size centroid selectionMedium
- Binary Tree Maximum Path SumBinary tree · Any-endpoint maximum path DPHard
- Serialize and Deserialize Binary TreeBinary tree · Serialization/deserialization APIHard
- Binary Tree CamerasBinary tree · Three-state camera greedy / DPHard
- Vertical Order Traversal of a Binary TreeBinary tree · Coordinate ordering with value tiesHard
- Recover a Tree From Preorder TraversalBinary tree · Preorder depth parser reconstructionHard
- Sum of Distances in TreeGeneral tree · All-node distance rerootingHard
- Maximum Sum BST in Binary TreeBST · BST subtree summary DPHard
- Number of Ways to Reorder Array to Get Same BSTBST combinatorics · BST insertion-order combinatoricsHard
- Height of Binary Tree After Subtree Removal QueriesBinary tree · Outside-subtree height queriesHard
- Count Number of Possible Root NodesGeneral tree · Guessed-edge orientation rerootingHard
- Merge BSTs to Create Single BSTBST · Leaf grafting with global BST boundsHard
- Number of Good PathsGeneral tree · Value-threshold union-find pathsHard
- Count Subtrees With Max Distance Between CitiesGeneral tree · Connected-subset diameter enumerationHard
- Minimum Score After Removals on a TreeGeneral tree · Two-edge cuts / component XORHard
- Difference Between Maximum and Minimum Price SumGeneral tree · Weighted path rerootingHard
- Minimize the Total Price of the TripsGeneral tree · Trip path frequencies + independent-set DPHard
- Count Valid Paths in a TreeGeneral tree · Prime/nonprime path component countingHard
- Minimum Diameter After Merging Two TreesGeneral tree · Diameter/center merge optimizationHard
- Kth Ancestor of a Tree NodeGeneral tree · Binary-lifting ancestor data structureHard
- Maximum Genetic Difference QueryGeneral tree · Ancestor XOR trie with rollbackHard
- Largest BST SubtreeBST · BST subtree size summary DPHard
- K-th Smallest on Tree PathGeneral tree · Persistent frequencies + LCA kth pathHard
- Distinct Elements on Tree PathGeneral tree · Offline distinct-color path queriesHard
- Subtree Frequency Queries with DSU on TreeGeneral tree · DSU-on-tree frequency thresholdsHard
- Heavy-Light Decomposition with Path and Subtree UpdatesGeneral tree · Heavy-light path/subtree lazy updatesHard
- Centroid Decomposition: Count Paths of Length KGeneral tree · Centroid exact-length pair countsHard
- Optimal Tree Knapsack with Subtree Dependency in O(N * W)General tree · Ancestor-dependent DFS-order knapsackHard
- Tree Isomorphism for Unrooted TreesGeneral tree · Unrooted canonical tree isomorphismHard
- Count Paths with Given XOR Sum in a TreeGeneral tree · Node-XOR path countingHard
- Tree Diameter after Subtree Severance in O(1) per QueryGeneral tree · Outside-subtree diameter rerootingHard
- Generalized R-Dominating Set on TreesGeneral tree · Radius domination greedy / DPHard
- Dynamic Tree Center and Radius with Node InsertionsGeneral tree · Insertion-only diameter endpoints / LCAHard
- Implicit Treap with Lazy Range ReversalsAuxiliary binary tree · Implicit treap split/merge/reversalHard
- Maximum Selected Component Sum after at Most K CutsGeneral tree · Cut-budget component selectionHard
- Virtual Tree: Disconnect Query VerticesGeneral tree · Virtual-tree minimum separating cutVery hard
- Link-Cut Tree: Dynamic Forest Path MaximumGeneral tree · Link-cut dynamic forestVery hard
- Dynamic Tree DP: Maximum Independent Set with Point UpdatesGeneral tree · Dynamic max-plus independent-set DPVery hard
- Cartesian Tree Construction and Range Minimum QueriesAuxiliary binary tree · Cartesian tree + optimal static RMQVery hard
- All-Pairs Distance Frequencies via Centroid Decomposition and FFTGeneral tree · Centroid distance convolutionVery hard
- Dynamic Tree Path K-th Element with Point UpdatesGeneral tree · Dynamic path order statisticsVery hard
- Count Induced Subtrees with Bounded DiameterGeneral tree · Bounded-diameter connected-subset countingVery hard