BST - 20: Check if given Binary Tree is BST

Описание к видео BST - 20: Check if given Binary Tree is BST

Source Code:https://thecodingsimplified.com/check...
Solution:
We traverse the binary tree in inorder manner
We take a global variable 'prev'.
Now whenever we're traversing any node, we check node value with previous node value
If current node value is less than previous value, we return false, else we keep on checking.
We check this for all nodes in tree

Time Complexity: O(n)
Space Complexity: O(1)

Do Watch video for more info

CHECK OUT CODING SIMPLIFIED
   / codingsimplified  

★☆★ VIEW THE BLOG POST: ★☆★
http://thecodingsimplified.com

I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 200+ videos.

★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★
https://www.youtube.com/codingsimplif...

★☆★ Send us mail at: ★☆★
Email: [email protected]

Комментарии

Информация по комментариям в разработке