Check element in Binary Search Tree

Given a binary search tree with positive integers, check if given element is present in the given tree. for eg: 14 / \ / \ 3 17 / \ / \ 2 4 16 18 k = 9 Output: false k = 16 Output: true Here is sample Node.java (No need to upload this) public class Node { public int nodeValue; public Node lChild; public Node rChild; }

Answer

No comments:

Post a Comment