Binary search tree is constructed by repeatedly, C/C++ Programming

Assume that a Binary Search Tree is constructed by repeatedly inserting exact values in to the tree. Argue that the number of nodes examined in searching for a value in the tree is one + the number of nodes determined when the value was first inserted in to the tree

Let us take an element x to insert in a binary search tree. So for inserting the 

 

1634_11.png

 

element x first at level 0,then level 1 and assume upto level (d-1). While determine at (d-1) level, x may have less or more in comparison to element at (d-1). The we enter x either left or right. In both cases no of determined code will be d. Now Assume we require to search for x, this time again traverses the similar path as we traverse. Whereas inserting the element, we stop at (d-1) the level but for searching we determine node at dth level also i.e. the node  having x. Thus number of node determine while inserting are d while     incase  of searching it is d+1 i.e. one more than whereas inserting, as the result.

 

 

Posted Date: 5/3/2013 3:40:58 AM | Location : United States







Related Discussions:- Binary search tree is constructed by repeatedly, Assignment Help, Ask Question on Binary search tree is constructed by repeatedly, Get Answer, Expert's Help, Binary search tree is constructed by repeatedly Discussions

Write discussion on Binary search tree is constructed by repeatedly
Your posts are moderated
Related Questions
write a program that adds all numbers from 1 to 200

Write an algorithm to print all even numbers in descending order and draw the flowchart.


Write a c++ program to find the sum of 0.123 ? 103 and 0.456 ? 102 and write the result in three significant digits.

F u nction Returning Object: This program is like to the previous program except the function returns object.  The main rule to be remembered is the function returning obj

getting a palindrome using minimum replacement

decode smugglers are very smart in day by day

B-tree: A B-tree is an also called balanced m-way tree. A node of the tree may have many records or key and pointers to children. It is also called as the balanced sort tree. It s

Write a program to act as an electronic safe. If the correct code has been entered the program should display "Safe Open".  If an incorrect code is input it should display "Alarm"

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4