Java: Check whether a Binary Tree is BST or Not

Level : Advanced
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:30:00

Lab Details

Difficulty Level: EASY

Problem Statement:

Write a program to check whether a binary tree is Binary Search Tree or not using Inorder Traversal.

A binary search tree (BST) is a node-based binary tree data structure that has the following properties.

• The left subtree of a node contains only nodes with keys less than the node’s key.

• The right subtree of a node contains only nodes with keys greater than the node’s key.

• Both the left and right subtrees must also be binary search trees.

• Each node (item in the tree) has a distinct key.

Input:

Output:

Not a BST


Self-paced Membership
  • 22+ Courses
  • 750+ Hands-On Labs
  • 200+ Quick Notes
  • 55+ Skill Tests
  • 45+ Interview Q&A
  • 10+ Real-world Projects
  • Career Coaching
  • Email Support
Upto 66% OFF
KNOW MORE..

To get full access to all courses

Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this