Test whether a binary tree is a binary search tree, Data Structure & Algorithms

Assignment Help:

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

Ans.

The algorithm to check 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:- Test whether a binary tree is a binary search tree

Sparse matrix, what are the disadvantages of sparse matrix?

what are the disadvantages of sparse matrix?

Algorithm, what algorithms can i use for the above title in my project desi...

what algorithms can i use for the above title in my project desing and implmentation of road transport booking system

Pseudo code, I need help writing a pseudocode for my assignment can anyone ...

I need help writing a pseudocode for my assignment can anyone help?

Logic circuits, the voltage wave forms are applied at the inputs of an EX-O...

the voltage wave forms are applied at the inputs of an EX-OR gate. determine the output wave form

B-tree of degree 3, Q. Explain the result of inserting the keys given. ...

Q. Explain the result of inserting the keys given. F, S, Q, K, C, L, H, T, V, W, M, R, N, P, A, B, X, Y, D, Z, E  in an order to an empty B-tree of degree-3.

FOLDING METHOD, 12345 SOLVE BY USING FOLDING METHOD

12345 SOLVE BY USING FOLDING METHOD

Algorithm for sorting a deck of cards, What is wrong with the following alg...

What is wrong with the following algorithm for sorting a deck of cards (considering the basic properties of algorithms)? I. Put the cards together into a pile II. For each ca

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

A difference between linear and non linear, state difference between linear...

state difference between linear and non linear data structure. give one example scenario of each

Process of channel access, Channel access In first generation systems, ...

Channel access In first generation systems, every cell supports a number of channels. At any given time a channel is allocated to only one user. Second generation systems also

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