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
In how many ways can 3 letters be chosen from M, N, O, P, Q, R,...
In how many ways can 3 letters be chosen from M, N, O, P, Q, R,
S, assuming that the order of the choices doesn't matter and that
repeats are not allowed?
Using seven different Scrabble blocks with the letters:
a,e,o,n,r,s,t written on them:
a) How many different...
Using seven different Scrabble blocks with the letters:
a,e,o,n,r,s,t written on them:
a) How many different seven letter arrangements are
possible?
b) How many three letter arrangements are possible?
c) If I choose three letters, then in how many ways can I do
this
d) If I select six letters then in how many ways can I do
this
1. Given an
n-element array A, Algorithm X executes an
O(n)-time computation for each even
number...
1. Given an
n-element array A, Algorithm X executes an
O(n)-time computation for each even
number in A and an O(log n)-time computation for
each odd number in A.
What is the best-case running time of Algorithm X?
What is the worst-case running time of Algorithm X?
2. Given an array,
A, of n integers, give an O(n)-time algorithm that finds
the longest subarray of A such that all the numbers in that
subarray are in sorted order. Your algorithm...
Consider permutations of the 26-character lowercase alphabet
Σ={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}.
In how many of these permutations do
a,b,c...
Consider permutations of the 26-character lowercase alphabet
Σ={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}.
In how many of these permutations do
a,b,c occur consecutively and in that
order?
In how many of these permutations does a appear before
b and b appear before c?