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 j-1 i=0 0; くA/2 a; < 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

1 Expert Approved Answer
Step: 1 Unlock

To build the search tree T we will use the following divide and conquer algorithm Find the item xj w... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Data Structures Algorithms Questions!