Completed

aj

Given an integer pair p, the first integer is called [url removed, login to view] and the second integer is called p.second. Given a set s of integer points, the first-sum is the sum of all the first integers in the set: first-sum(s) = sum([url removed, login to view]) for all p in s. Similarly, the second-sum is the sum of all the second integers in the set: second-sum(s) = sum([url removed, login to view]) for all p in s Given a set s of integer points, the difference-sum is the absolute value of the difference between first-sum(s) and second-sum(s); that is difference-sum(s) = | first-sum(s) - second-sum(s) | for the same set s of integer pairs, the total-sum is the sum of the first and sums: total-sum(s) = first-sum(s) + second-sum(s) The Problem Write a procedure that accepts a vector of integer pairs V and an non-negative integer n and returns an n-element subset of the integer pairs S having the following properties: The difference-sum of the returned subset is among the smallest of the difference-sums of all possible n-element subsets of V. That is, if s is the returned subset, then difference-sum(s) <= difference-sum(s) for any n-element subset s' of V If s' is another n-element subset of V having the same difference sum as s, then the total sum s is no smaller than the total sum s'. That is, For any n-element subset s' of V, if difference-sum(s) == difference-sum(s'), then total-sum(s') <= total-sum(s). The prototype for your procedure should be std::vector pick_pairs( const std::vector &, unsigned n); Your procedure returns not the pairs themselves, but the indices of the input vector for the pairs in the subset. If n is greater than the input vector size, your procedure should print an error message and exit.

## Deliverables

Complete the project using STL of C++ and should be fully-functional and tested for all input validations working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased.

## Platform

It should be compiled and tested on Sunsolaris,Unix,Linux with C++ and STL

Skills: C Programming, Engineering, Linux, MySQL, PHP, Project Management, Software Architecture, Software Testing, Testing / QA, UNIX, Usability Testing, Website Testing

See more: vector stl, vector set size, vector pair, vector of pairs, vector element, using stl vector, using stl, unsigned integer, stl vector size, stl vector, stl size, stl set, stl in c, stl code, set stl, set of pairs, pair stl, pair of points, integers and, stl, std, integer programming, AJ, php print error, indices

About the Employer:
( 5 reviews ) United States

Project ID: #2844036

Awarded to:

ziran

See private message.

$21.25 USD in 14 days
(47 Reviews)
4.5

5 freelancers are bidding on average $29 for this job

vw181638vw

See private message.

$34 USD in 14 days
(44 Reviews)
5.4
salac

See private message.

$38.25 USD in 14 days
(42 Reviews)
4.6
teamsgreen

See private message.

$42.5 USD in 14 days
(48 Reviews)
4.3
praveenkumarvw

See private message.

$8.5 USD in 14 days
(0 Reviews)
0.0