树
Data Structures & Algorithms · 15 notes
- Postorder Traversal Sequence of a Binary Search Treehistorical
Record a recursive method for determining whether a sequence is the postorder traversal result of a binary search tree.
- Next Node in a Binary Treehistorical
Record methods for finding the inorder successor of a binary-tree node through a full inorder traversal or parent-pointer relationships.
- Binary Search Tree and Doubly Linked Listhistorical
Record inorder-traversal and recursive methods for converting a binary search tree into a sorted doubly linked list.
- Kth Node in a Binary Search Treehistorical
Record inorder-traversal methods for finding the kth smallest node in a binary search tree, plus reverse inorder traversal for the kth largest node.
- Depth of a Binary Treehistorical
Record a recursive method for computing binary-tree depth by taking the greater depth of the left and right subtrees.
- Print a Binary Tree from Top to Bottomhistorical
Record queue-based level-order traversal for printing binary-tree nodes from top to bottom.
- Symmetric Binary Treehistorical
Record a recursive method for determining whether a binary tree is symmetric by comparing mirrored positions in its left and right subtrees.
- Balanced Binary Treehistorical
Record a method for determining whether a binary tree is balanced by comparing subtree heights and recursively checking both subtrees.
- Mirror of a Binary Treehistorical
Record recursive, stack-based, and queue-based methods for generating the mirror of a binary tree by swapping left and right subtrees.
- Print a Binary Tree in Multiple Lineshistorical
Record a queue-based method that uses end-of-line pointers to print a binary tree level by level, one line per level.
- Print a Binary Tree in Zigzag Orderhistorical
Record a zigzag traversal method by reversing alternating rows after level-order traversal.
- Substructure of a Treehistorical
Record a preorder-recursive matching method for determining whether one binary tree is a substructure of another.
- Reconstruct Binary Treehistorical
Record the recursive method for reconstructing a binary tree from preorder and inorder traversal results.
- Paths in a Binary Tree With a Given Sumhistorical
Record the depth-first, preorder traversal, and backtracking method for finding binary-tree paths with a given sum.
- Serialize a Binary Treehistorical
Record methods for serializing and deserializing a binary tree using preorder traversal and a preorder-plus-inorder traversal combination.