Programming Assignment 7 - Grouping

Advanced Programming II, Fall 2001


Due Date

This assignment is due by 2:00 p.m. on Friday, 14 December.

See the assignment turn-in page (last modified on 11 September 2001) for instructions on turning in your assignment.

The Problem

Write a function with the prototype

vector<vector<unsigned> > group(const vector<unsigned> &);

that accepts a vector of positive integers and returns a vector of integer vectors such that

  1. The number of integer vectors returned is as small as possible, but is larger than 1.

  2. The sum of the integers in each integer vector returned is the same as the sum of the integers in any other integer vector returned.

  3. All the integers in the output vector appear in the input vector and vice versa.

You can test your procedure by compiling it with the file

/export/home/class/cs-509/pa7/main.cc

and running the resulting executable.


This page last modified on 28 November 2001.