Whether a binary tree is a binary search tree or not, Data Structure & Algorithms

Assignment Help:

Write an algorithm to test whether a Binary Tree is a Binary Search Tree.

The algorithm to test whether a Binary tree is as Binary Search tree is as follows:

bstree(*tree)
{
while((tree->left !=null)&& (tree->right !=null))
 {
  if(tree->left < tree->root)
   bstree(tree->left);
  else
   return(1);
  if(tree->right > tree->root)
   bstree(tree->right);
  else
  return(1);
 }
 return(0);


Related Discussions:- Whether a binary tree is a binary search tree or not

Omega notation, The ?-Notation (Lower Bound) This notation provides a l...

The ?-Notation (Lower Bound) This notation provides a lower bound for a function to within a constant factor. We write f(n) = ?(g(n)), if there are positive constants n 0 and

Define the terms - key attribute and value set, Define the terms   ...

Define the terms     i) Key attribute     ii) Value set  Key attribute:  An entity  type  usually  has  an attribute  whose  values  are  distinct  fr

Explain in detail about the ruby arrays, Explain in detail about the Ruby a...

Explain in detail about the Ruby arrays Ruby arrays have many interesting and powerful methods. Besides indexing operations which go well beyond those discussed above, arrays h

What is a height balanced tree, What is a height balanced tree? Height Ba...

What is a height balanced tree? Height Balanced Tree (AVL Tree) An AVL tree is a binary search tree in which the height of the left and right subtree of the root vary by at most

Rooted tree, It does not have any cycles (circuits, or closed paths), which...

It does not have any cycles (circuits, or closed paths), which would imply the existence of more than one path among two nodes. It is the most general kind of tree, and might be co

Design a doubly linked list, Instructions : You have to design a dou...

Instructions : You have to design a doubly linked list container. The necessary classes and their declarations are given below The main() function for testing the yo

Explain principle of optimality, Explain principle of Optimality It ind...

Explain principle of Optimality It indicates that an optimal solution to any instance of an optimization problem is composed of  optimal solutions to its subinstances.

Financial index data analysis, need c++ algorithmic software program to der...

need c++ algorithmic software program to derive one numerical outcome from 10 levels of variables with 135 combinations cross computed

5/11/2013 1:51:51 AM

Thanks for suggesting me this answer, appreciate your knowledge.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd