Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.
Algorithm 1 - Constructing the BST
ConstructBST
{
foreach flyer // n flyers
{
insert flyer in the BST // O(log n) or O(n) worst case
}
}
---------------------------------------------------------
Algorithm 2 - Picking
input: array A[1..n] with elements sorted in non-crescent oreder
N, the number of elements in the array
output: array B[1..log n] with (log n) higher flyers
Picking
{
total = log N
for i =1 to total
{
B[i] = A[i]
}
}
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.