Skip to content

Commit

Permalink
Update Size_of_largest_BST_in_binary_tree.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Riddhi12349 authored Nov 6, 2024
1 parent 823226e commit 50fd90c
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@ id: size-of-largest-bst-in-binary-tree
title: Size of Largest BST in Binary Tree
sidebar_label: GFG
tags: [GFG , Binary Tree , BST]
description: A Tree is BST if following is true for every root node x.

The largest value in left subtree (of x) is smaller than value of x.
The smallest value in right subtree (of x) is greater than value of x.

We will traverse the tree in a bottom-up manner. For every traversed node, we return the maximum and minimum values in the subtree rooted at that node. The idea is to determine whether the subtree rooted at each node is a Binary Search Tree (BST) (for subtree to be bst conditions mentioned above). If any node follows the properties of a BST and has the maximum size, we update the size of the largest BST.
description: Determine whether the subtree rooted at each node is a Binary Search Tree (BST). Find the size of the largest BST.
---

# Size of Largest BST in Binary Tree (GFG)

## Description

The **Size of Largest BST in Binary Tree** problem is based on determining whether the subtree rooted at each node is a Binary Search Tree (BST) (for subtree to be bst conditions mentioned above). If any node follows the properties of a BST and has the maximum size, we update the size of the largest BST.
The **Size of Largest BST in Binary Tree** problem is based on determining whether the subtree rooted at each node is a Binary Search Tree (BST). If any node follows the properties of a BST and has the maximum size, we update the size of the largest BST.

### Problem Definition

Expand Down

0 comments on commit 50fd90c

Please sign in to comment.