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

Computer arhitecture, The controversy of RISC versus CISC never ends. Suppo...

The controversy of RISC versus CISC never ends. Suppose that you represent an advocate for the RISC approach; write at least a one-page critic of the CISC approach showing its disa

Design and test a reference array, Instructions Design and test a r...

Instructions Design and test a reference array. Reference array stores the references to user supplied objects of different types. Just think it as a heterogeneous array wh

Reverse order of elements on a slack, Q. Reverse the order of the elements ...

Q. Reverse the order of the elements on a stack S    (i) by using two additional stacks (ii) by using one additional queue. Ans :      L e t S be the stac

Give example of assertion and abstract data type, Give example of assertion...

Give example of assertion and abstract data type For illustration, consider Natural ADT whose carrier set is the set of non-negative integers and whose operations are the usual

Explain circular queues, Circular Queues:- A more efficient queue repre...

Circular Queues:- A more efficient queue representation is get by regarding the array Q(1:n) as circular. It becomes more convenient to declare the array as Q(O: n-1), when  re

Flowcharts, draw a flowchart which prints all the even numbers between 1-50...

draw a flowchart which prints all the even numbers between 1-50

Implement stack using two queues, How To implement stack using two queues ,...

How To implement stack using two queues , analyze the running time of the stack operations ?

Stack, using a program flowchart design a program to illustrate pop and pus...

using a program flowchart design a program to illustrate pop and push operation

Hasing and indexing, differentiate between indexing and hashing in file org...

differentiate between indexing and hashing in file organization

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