Question

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

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 =
(^{2N}C_{N}) / (N+1)

**Problem 4**

**Answer :**

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

The minimum depth of a binary tree is [ log_{3}n ] and
the maximum depth is N`-2`

.

So in each level there will be [
(^{2N}C_{N}) / (N+1) ] / [ (N - 2 ) - ([
log_{3}n ]) ] nodes.

**Problem 5**

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...

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 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 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.
6
D.
8

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.

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.

Consider a binary search tree where each tree node v has a field
v.sum which stores the sum of all the keys in the subtree rooted at
v. We wish to add an operation SumLE(K) to this binary search tree
which returns the sum of all the keys in the tree whose values are
less than or equal to K.
(a) Describe an algorithm, SumLE(K), which returns the sum of
all the keys in the tree whose values are less...

We are given the following CSP problem.
The variables and domains are as follows.
A: {4, 5, 6, 7, 8}
B: {10, 20, 30, 40}
C: {2, 3, 4}
D: {28, 43, 56, 77, 94, 114}
The constraints are:
A + C is odd.
A + D is a square of an integer.
B + D < 60.
Solve this problem using the following heuristics and
algorithms.
• Use backtracking search.
• For variable ordering, use MRV. If there are...

In this lab, you will write a program that creates a binary
search tree based on user input. Then, the user will indicate what
order to print the values in. **Please write in C code**
Start with the bst.h and bst.c base code provided to you. You
will need to modify the source and header file to complete this
lab.
bst.h:
#ifndef BST_H
#define BST_H
typedef struct BSTNode
{
int value;
struct BSTNode* left;
struct BSTNode* right;
} BSTNode;
BSTNode*...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 1 minute ago

asked 7 minutes ago

asked 21 minutes ago

asked 35 minutes ago

asked 45 minutes ago

asked 59 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago