Tag: binary_search_tree
Lowest Common Ancestor in Binary Search Tree
Date: 2/15/2024Tags:algorithmsleetcodebinary_search_treeThis journal entry discusses the concept of the lowest common ancestor in a binary search tree and provides a code implementation to find it.
Largest BST Subtree - 3rd attempt
Date: 2/9/2024Tags:algorithmsleetcodebinary_search_treeDuring the attempt to solve the "Largest BST Subtree" problem, important insights were gained regarding the resetting of the previous pointer and the purpose of checking for null before node comparisons, and these insights were incorporated into the revised code provided.
Largest BST Subtree - 2nd attempt
Date: 2/8/2024Tags:algorithmsleetcodebinary_search_treeThe journal entry discusses a complex recursive problem of finding the largest BST subtree, utilizing the `isValidBST` function to validate BST properties, `countNodes` to count the number of nodes, and `largestBSTSubtree` to find the maximum valid BST subtree size. The code includes a variable `previous` initialized as null, and three functions: `isValidBST`, `countNodes`, and `largestBSTSubtree`.
Largest BST Subtree
Date: 2/7/2024Tags:algorithmsleetcodebinary_search_treeThe journal entry discusses an algorithm for identifying the largest Binary Search Tree (BST) subtree within a given binary tree, utilizing functions for validating BST, counting nodes, and finding the largest BST subtree recursively. The code provided includes implementations of these functions.
Closest Nodes Queries in a Binary Search Tree - 3rd attempt
Date: 2/7/2024Tags:algorithmsleetcodebinary_search_treeThe journal entry titled "Closest Nodes Queries in a Binary Search Tree - 3rd attempt" discusses the problem of finding the closest nodes in a binary search tree (BST) for a given set of queries. It includes insights on the binary search algorithm and the complexity of in-order traversal. The entry also provides a code implementation of the solution using a TreeNode class and a Tree class.