Добавить
Уведомления

Floor in BST ?| Simple Recursion | 4 lines code | ?? C++, Java & Python | POTD | Geeksforgeeks

In this video, I solved the "Floor in BST" problem, which is a medium level question asked on Geeksforgeeks. The problem requires finding the greatest value node of a Binary Search Tree (BST) that is smaller than or equal to a given value. I explained the simple recursive solution along with the property of Binary Search Tree to solve the problem. The idea is to do the recursion on the left side of the root if the data of the root is greater than target or do the recursion on the right side of the root if the data of the root is less than or equal to target. 00:00 Introductory Note 00:08 Introduction to the problem 01:00 Understanding Binary Search Tree 03:12 Understanding the question 05:51 Framing the approach to solve the problem 10:28 Going through the code The code is very time-efficient (O(n)), where n is the number of nodes in the tree and space-efficient (O(1)). I have also made a GitHub repository of codes to this problem in C++, Java, and Python languages. GitHub Repo Link: https://github.com/AlgoZenithNITC/GFG_POTD_Solutions_AlgoZenithNITC/tree/main Please watch this video and share it with your friends who are interested in programming. Don't forget to subscribe to my channel for more exciting videos like this one! ???

Иконка канала Tech Watch
2 подписчика
12+
16 просмотров
2 года назад
12+
16 просмотров
2 года назад

In this video, I solved the "Floor in BST" problem, which is a medium level question asked on Geeksforgeeks. The problem requires finding the greatest value node of a Binary Search Tree (BST) that is smaller than or equal to a given value. I explained the simple recursive solution along with the property of Binary Search Tree to solve the problem. The idea is to do the recursion on the left side of the root if the data of the root is greater than target or do the recursion on the right side of the root if the data of the root is less than or equal to target. 00:00 Introductory Note 00:08 Introduction to the problem 01:00 Understanding Binary Search Tree 03:12 Understanding the question 05:51 Framing the approach to solve the problem 10:28 Going through the code The code is very time-efficient (O(n)), where n is the number of nodes in the tree and space-efficient (O(1)). I have also made a GitHub repository of codes to this problem in C++, Java, and Python languages. GitHub Repo Link: https://github.com/AlgoZenithNITC/GFG_POTD_Solutions_AlgoZenithNITC/tree/main Please watch this video and share it with your friends who are interested in programming. Don't forget to subscribe to my channel for more exciting videos like this one! ???

, чтобы оставлять комментарии