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:...
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?
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
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.
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....
Project 1 - NodeList write in c++ with 5 files: main.cpp List.h List.cpp ListNode.h ListNode.cpp Building...
Project 1 - NodeList write in c++ with 5 files: main.cpp List.h List.cpp ListNode.h ListNode.cpp Building upon the the ListNode/List code I would like you to extend the interface of a list to have these member functions as well. struct ListNode { int element; ListNode *next; } Write a function to concatenate two linked lists. Given lists l1 = (2, 3, 1)and l2 = (4, 5), after return from l1.concatenate(l2)the list l1should be changed to be l1 = (2, 3,...
Determine whether the shapes given below are always, sometimes, or never similar. Briefly explain your answers....
Determine whether the shapes given below are always, sometimes, or never similar. Briefly explain your answers. (Hint: The scale factor might be useful for some of these.) 1 A large circle and a smaller circle. 2 A large ellipse (oval) and a smaller ellipse. 3 Two rectangles. 4 Two *golden* rectangles. 5 Two pentagons. 6 Two *regular* pentagons. 7 A regular pentagon and a regular hexagon. 8 Two isosceles triangles.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT