Question

What is the complexity of a balanced binary tree search? Complexity of searching one item in...

What is the complexity of a balanced binary tree search? Complexity of searching one item in a balanced tree. The height of a balanced search tree is? Once is balanced there would a maximum height of the tree, what’s that? Explain in your own words.

Homework Answers

Answer #1

The complexity of a balanced binary tree search is O(logn)

Explanation: When we traverse a binary search tree, we can go either left or right thus we remove one portion per traversing. So, the time complexity of log n is created.

The Complexity of searching one item in a balanced tree: O(logn)

Explanation: In a balanced tree, the worst-case scenario to search a number is O(logn) as we're eliminating a whole portion(either left or right) each time.

The height of a balanced search tree is: Log(n)

Eg: log(1) = 0

log(2) = 1

log(3) = 1

log(4) = 2

for balanced tree, total nodes are: 1, 3, 7 etc.

The height will be:   

for 1 node: log(1) = 0

for 3 node: log(1) = 1

for 7 node: log(1) = 2

Similarly, for a balanced tree with n nodes, the maximum height will be Log(n).

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Is searching an element in a Binary Search Tree (BST) faster than finding an element in...
Is searching an element in a Binary Search Tree (BST) faster than finding an element in a Binary Tree? If yes, explain why? (this is for Java programing)
1. Assume the key of the right child below the root node of a binary search...
1. Assume the key of the right child below the root node of a binary search tree is 40. The value in the root node could be ________. 2. On average, searching for an item in a balanced binary search tree is _________ operation. 3. Where is the inorder successor of a node A in a binary search tree?
State True or False. i) Binary search is used for searching in a sorted array. AND...
State True or False. i) Binary search is used for searching in a sorted array. AND ii) The time complexity of binary search is O(log n). A) True, False B) False, True C) False, False D) True, True Explain
what is the common between binary search tree and B tree? Can all the binary search...
what is the common between binary search tree and B tree? Can all the binary search tree be considered a special case of some vaild B tree why or why not?
1) Put these integers into a binary search tree and then state the output of a...
1) Put these integers into a binary search tree and then state the output of a preorder traversal. Put EXACTLY ONE SPACE between each integer, so your output looks like this: 1 2 3 4 5 These are the integers to put into the tree: 41 17 80 25 8 11 50 60 100 Output: ____ 2) Put these integers into a binary search tree and then state the output of a preorder traversal. Put EXACTLY ONE SPACE between each...
Given the list of values below, create a Binary Search Tree for the list, Use the...
Given the list of values below, create a Binary Search Tree for the list, Use the first value in the list as the root of the tree, add the nodes to BST in the order they appear in the list.[50, 44, 82, 39, 35, 98, 87, 100, 74, 23, 34, 14, 94] What is the minimum height of a Binary Tree that contains 24nodes? What is the minimum height of a Binary Tree that contains 64nodes? What is the minimum...
‏What is the output of the Euler tour in the normal binary search tree if the...
‏What is the output of the Euler tour in the normal binary search tree if the key insert order is 5 , 2 , 8 , 5 , 9 , 5 , 1 , 3 , 4 , 2 , 8 ? All keys equal to the node should be the right subtree of that node. ____________________________________________________________ ‏Construct the binary max - heap for the keys given below. Once all the keys are inserted, perform the remove maximum operation, and...
The one missing piece was inserting into a binary search tree; we'll take care of that...
The one missing piece was inserting into a binary search tree; we'll take care of that today and write the insert function, as well as a height function. Both functions will be implemented in the "bst.h" header file, and tested using a provided main program in "main.cpp". Step one is to implement the insert function --- go ahead and modify "bst.h", adding the necessary code to (1) allocate a new node, and (b) link it into the tree. Once you...
This assignment involves using a binary search tree (BST) to keep track of all words in...
This assignment involves using a binary search tree (BST) to keep track of all words in a text document. It produces a cross-reference, or a concordance. This is very much like assignment 4, except that you must use a different data structure. You may use some of the code you wrote for that assignment, such as input parsing, for this one. Remember that in a binary search tree, the value to the left of the root is less than the...
Suppose T is a binary search tree of height 4 (including the external nodes) that is...
Suppose T is a binary search tree of height 4 (including the external nodes) that is storing all the integers in the range from 1 to 15, inclusive. Suppose further that you do a search for the number 11. Explain why it is impossible for the sequence of numbers you encounter in this search to be (9, 12, 10, 11).