Part 5 of 15 in Binary Search Trees  

Search an element in a binary search tree by animeshn

Problem statement

Write a function to search for a Node with a given data in a binary search tree. A binary search tree is a binary tree in which value of all the nodes left of a node are lesser than it and value of all the nodes right of node are greater than it. You may assume that there are no duplicate values in the tree.


You need to write a function named "SearchNodeInBST" that will take root of a binary search tree and the data to be searched as argument.


Your function must return pointer to node having the data in the tree. If there is no such data in the tree simply return NULL.

To try out your code

Sign in

Sign up