Fading Coder

One Final Commit for the Last Sprint

Search Algorithms and Binary Search Tree Implementation

Search algorithms are fundamental techniques for locating specific elements within data collections. These collections may be stored as arrays, linked lists, or hash tables. Choosing the right search strategy significantly impacts application performance. Search Algorithm Categories Sequential Searc...

Finding the Lowest Common Ancestor in a Binary Tree

Minimum Absolute Difference in a Binary Search Tree To compute the minimum absolute difference between values in a binary search tree, leverage the property that an in-order traversal yields a sorted sequence. By tracking the previous node during traversal, differences can be calculatde efficiently....

Binary Search Tree Manipulations: Pruning, Sorted Array Construction, and Cumulative Sum Conversion

Pruning a Binary Search Tree When removing nodes from a BST that fall outside a specified range [minVal, maxVal], the BST property must be maintained. If a node's value is less than the minimum threshold, the node and its entire left subtree are invalid. The valid result must come from the right sub...

Finding the Lowest Common Ancestor in a Binary Search Tree Using BST Properties

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two specified nodes. The LCA is defined as the deepest node that is an ancestor to both nodes, where a node can be its own anecstor. For example, consider a BST with root = [6,2,8,0,4,7,9,null,null,3,5]. Example 1: Input: roo...

Implementing and Applying Binary Search Trees in C++

A Binary Search Tree (BST) is a specialized binary tree structure where each node's left subtree contains only values less than the node's key, and its right subtree contains only values greater than the key. This property must hold recursive for all subtrees. An in-order traversal of a BST yields t...