Question: Suppose we are given a sorted sequence S of items (x 0 , x 1 ,...,x n1 ) such that each item xi in S
Suppose we are given a sorted sequence S of items (x0, x1,...,xn−1) such that each item xi in S is given a positive integer weight ai. Let A denote the total weight of all elements in S. Construct an O(n log n)-time algorithm that builds a search tree T for S such that the depth of each item ai is O(log A/ai).
Find the item xj with largest j such that
Consider putting this item at the root and recursing on the two subsequences that this induces.
j-1 i=0 0; A/2 a;
Step by Step Solution
3.46 Rating (156 Votes )
There are 3 Steps involved in it
To build the search tree T we will use the following divide and conquer algorithm Find the item xj w... View full answer
Get step-by-step solutions from verified subject matter experts
