Question

Problem 3 Given a BST with N nodes, how many tree shapes are there with height...

Problem 3

Given a BST with N nodes, how many tree shapes are there with height N-1? Explain your reasoning.

Problem 4

Given a BST with N nodes, how many tree shapes are there with height N-2? Explain your reasoning .

Problem 5

Consider an empty 2-3 tree. Draw the tree after each of the following operations is executed:

insert 0, insert 9, insert 2, insert 6, insert 7, insert 3, insert 8, delete 2, delete 6

Homework Answers

Answer #1

Problem 3

Answer :

Given a BST with N nodes ,

then the maximum height of that tree will be N-1.

given that height is N-1 , then it means all nodes will have only one child like a chain structure .

the total number of Binary Tree possible with N nodes = (2NCN) / (N+1)

Problem 4

Answer :

Given a BST with N nodes , and height is N-2

The minimum depth of a binary tree is [ log3n ] and the maximum depth is N-2.

So in each level there will be  [ (2NCN) / (N+1) ] / [ (N - 2 ) - ([ log3n ]) ] nodes.

Problem 5

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
Exercise 3: Multi-way Trees A way to reduce the height of tree and ensure balance is...
Exercise 3: Multi-way Trees A way to reduce the height of tree and ensure balance is to allow multiple children of nodes. In your class you learned 2-3 trees which allows up to 2 keys in a node, and the number of children is equal to the number of keys + 1. B-trees extend this concept to any arbitrary number of keys (usually number of keys is even and number of children (equal to number of keys+1) is odd). Assume...
The Binary Search Tree implementation for bst.zip. The code in the destructor of the BST class...
The Binary Search Tree implementation for bst.zip. The code in the destructor of the BST class is empty. Complete the destructor so the memory allocated for each node in the BST is freed. Make a couple of different trees in your main method or in a function to test the destructor (the program should not crash upon exiting). bst.zip (includes the following files below in c++): bst.h: #pragma once #include #include "node.cpp" using namespace std; template class BST { public:...
4.Construct a B+-tree for the following set of values: (2, 3, 5, 7, 11, 17, 19,...
4.Construct a B+-tree for the following set of values: (2, 3, 5, 7, 11, 17, 19, 23, 29, 31). Assume that the tree is initially empty and the values are added in ascending order. Let the degree of the tree be four, i.e. at most four pointers are allowed in any node. In your answer show the final tree. 5.Show your tree from from question 4 mentioned above after we insert 10. 6.Show your tree from from question 4 mentioned...
import java.util.ArrayList; /* Rules:         1. Allow Tester to iterate through all nodes using the...
import java.util.ArrayList; /* Rules:         1. Allow Tester to iterate through all nodes using the in-order traversal as the default.             This means, in Tester the following code should work for an instance of this class             called bst that is storing Student objects for the data:                 BinarySearchTree_Lab08<String> bst = new BinarySearchTree_Lab08<String>();                 bst.add("Man");       bst.add("Soda");   bst.add("Flag");                 bst.add("Home");   bst.add("Today");   bst.add("Jack");                ...
This is in java and you are not allowed to use Java API classes for queues,...
This is in java and you are not allowed to use Java API classes for queues, stacks, arrays, arraylists and linkedlists. You have to write your own implementations for them. You should construct a BST by inserting node values starting with a null tree. You can re-use the code for the insert method given in the sample code from the textbook. -insert method is provided below Your code should have a menu driven user interface at the command line with...
Problems: 1-How many nodes would you expect to find when n=3? Where would you expect the...
Problems: 1-How many nodes would you expect to find when n=3? Where would you expect the maxima to be (psi)? 2- What is the minimum n value where you could start finding (psi) with a value < 0? 3-What is the minimum n value where you could start finding (psi)^2 with a value < 0?
Consider the problem of summing n numbers by adding together various pairs of numbers and/or partial...
Consider the problem of summing n numbers by adding together various pairs of numbers and/or partial sums, for example, {[(3+1)+(2+5)]+9}. (a) Represent this addition process with a tree. What will internal vertices represent? (b) What is the smallest possible height of an “addition tree” for summing 100 numbers?
Consider functions f : {1, 2, 3, 4} → {−1, 0,1, 2, 3, 4}. (a) How...
Consider functions f : {1, 2, 3, 4} → {−1, 0,1, 2, 3, 4}. (a) How many functions are there total? Explain your reasoning. (b) How many functions are injective? Explain your reasoning.
How many terminal payoffs are there in a 2-step binomial tree? A. 3 B. 4 C....
How many terminal payoffs are there in a 2-step binomial tree? A. 3 B. 4 C. 6 D. 8
Here is a modification of the BST program that includes a recursive find method: BinarySearchTree2C.java (posted...
Here is a modification of the BST program that includes a recursive find method: BinarySearchTree2C.java (posted below) Implement the following methods using recursion: int depth() // returns the length of the deepest path from root to any leaf int node_count() // returns the number of nodes in the tree void insert(int n) // inserts value n into the tree BinarySearchTree2C clone() // returns a clone (deep copy) of the tree Add code to the main method to test these methods....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT