coderz.py

Keep Coding Keep Cheering!

Trees: Lowest Common Ancestor

What is the Lowest Common Ancestor? In a tree, the lowest common ancestor (LCA) of two nodes, n1 and n2, is the shared ancestor located farthest from the root and has both n1 and n2 as descendants. Properties of the Lowest Common Ancestor: An LCA can be one of the input nodes themselves if one […]

May 30, 2023 | Data Structure | No comments

Binary Search Tree (BST)

A Binary Search Tree (BST) is a type of binary tree that satisfies the following properties: For any node in the tree, all values in its left subtree are less than its value. For any node in the tree, all values in its right subtree are greater than its value. The left and right subtrees […]

May 29, 2023 | Data Structure | No comments

Binary Trees: Structure & Tree travels

Binary Tree Structure: A binary tree is a tree data structure where each node has at most two children: a left child and a right child. The topmost node of a binary tree is called the root node. Each node in a binary tree can have either zero, one, or two child nodes. The child […]

May 28, 2023 | Data Structure | No comments

Advertisement