Recursive tree traversal
Compute tree height
Return the height of a binary tree and define the result for an empty tree.
Advanced Topics in Computer Science
Students learn hierarchical data structures and the recursive algorithms that make trees powerful.
Unit Focus
The unit links recursion, searching, and structure design through binary trees and binary search trees.
Practice Work
Implement recursive tree traversals and print structured trace output.
Build a binary search tree and compare performance with a sorted ArrayList.
DSA Assignment Bank
Code Scholars provides structured assignments, implementation support, edge-case review, and runtime analysis coaching so students learn the concept rather than only memorizing a solution.
Recursive tree traversal
Return the height of a binary tree and define the result for an empty tree.
Bounds recursion
Check whether every node respects a valid lower and upper bound, not just its immediate children.
Recursive search
Given two nodes in a binary tree, find the lowest node that has both nodes in its subtrees.
Preorder with null markers
Convert a tree to a string and rebuild it while preserving missing children.
Recursive partitioning
Reconstruct a binary tree from preorder and inorder traversal arrays.
Recursive accumulation
Determine whether any root-to-leaf path has a target sum.
Backtracking on trees
Collect every root-to-leaf path while adding and removing values from a path list.
Postorder reasoning
Find the largest sum of any path in a tree and explain what value each recursive call returns to its parent.
Height plus validity
Return both height and balance status so the algorithm does not recompute heights repeatedly.
Recursive swapping
Swap left and right subtrees at every node and trace the result on a small example.
Queue-based traversal
Return tree values grouped by depth using a queue.
Level-order selection
Use breadth-first traversal to report the last visible node at each level.
Inorder traversal
Use the sorted order of inorder traversal to find the kth smallest value in a BST.
BST mutation
Delete a value from a BST and handle leaf, one-child, and two-child cases.
BST search path
Find the next larger value after a given value using tree structure rather than sorting all nodes.
Divide and conquer
Build a height-balanced BST by choosing middle elements recursively.
Traversal transformation
Rearrange a tree into a single right-child chain following preorder order.
Structure-based optimization
Use the shape of a complete binary tree to count nodes faster than visiting every node when possible.
Tree comparison
Determine whether one tree appears inside another using recursive equality checks.
Postorder aggregation
Compute the longest path between any two nodes using heights from subtrees.
Recursive evaluation
Evaluate a tree where leaves are numbers and internal nodes are operators.
Coordinate traversal
Assign horizontal positions to nodes and group values by column.
Inorder anomaly detection
Find two swapped nodes in a BST by looking for order violations during inorder traversal.
Recursive pruning
Remove nodes outside a value range while preserving valid BST structure.
Level tracking
Compute the sum of values on the deepest level of a binary tree.
Hierarchical modeling
Model folders and files as a tree and search for names matching a condition.
Tree interpretation
Given a simple decision tree, trace how an input record reaches a final classification.
Runtime tradeoff
Explain when a balanced BST gives an advantage over a sorted ArrayList and when it does not.
Aliasing and null checks
Given code that accidentally drops a subtree, identify the assignment order that causes the loss.
DSA support
Create a tree assignment requiring diagrams, recursive implementation, traversal tests, and runtime explanation.
Work through the concepts, code, edge cases, and runtime analysis with 1:1 guidance.