Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The input is a sequence of real numbers X = (x1, x2, , xn) in a non-decreasing order where n is even. The problem is

The input is a sequence of real numbers X = (x1, x2, , xn) in a non-decreasing order where n is even. The problem is to find a partition of X into n 2 pairs that minimizes the maximum value in S = {s1, s2, , s n 2 } where each si S denotes the sum of two numbers in pair i. For example, let X = (1, 2, 2, 4, 6, 6) and consider two partitions P1 = ((1, 2),(2, 4),(6, 6)) and P2 = ((1, 6),(2, 6),(2, 4)). Then, the maximum value of S1 = {3, 6, 12} resulted from P1 is 12 and the maximum value of S2 = {7, 8, 6} resulted from P2 is 8. Describe an O(n) time algorithm to solve the problem.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions