Перейти к содержимому

Predecessor and Successor in BST | Binary Search Tree | Python, Java & C++ | DSA

RisingBrain

0:00 / 0:00

Predecessor and Successor in BST | Binary Search Tree | Python, Java & C++ | DSA

1 258 просмотров · 12 дней назад
RisingBrain
41,5 тыс. подписчиков
1 258 просмотров · 12 дней назад
In this video, we solve the Predecessor and Successor in a Binary Search Tree (BST) problem and understand how to efficiently find the closest smaller and larger values for a given key. What you'll learn: What are BST Predecessor and Successor? How to find the Inorder Predecessor How to find the Inorder Successor Using BST properties for an optimized approach Handling different cases in BST Python, Java & C++ implementations Time and space complexity Complexity Time: O(H) Space: O(1) for the iterative approach A very important BST + Inorder concept for coding interviews and DSA preparation. Rising Brain (DSA Sheet): https://www.risingbrain.org/sheet Connect with me here: LinkedIn –   / anjalikumari22   Instagram –   / rbanjali.codes   Twitter (X) – https://x.com/anjali1kumari?s=21