Re: Can anyone help me on C++ question. tq

From: Will Twentyman (wtwentyman_at_read.my.sig)
Date: 04/13/04


Date: Tue, 13 Apr 2004 12:25:34 -0400

tmnet wrote:

> Dear all,
> Below is the question :
>
> Array manipulations, Class, Exception handling, Generic class.
>
> - design, implement and test a set class in c++ that provides the
> operations; set membership, set intersection, set union and set diferrence.
> An array is to be used to represent a set within a class.
>
> hope you all can help. thank you.
>

I'll be nice and assume you don't understand what a set is, rather than
wanting us to do your homework for you.

A set is a list without repetition, an array is a list.
Union merges sets, might be thought of as +.
Intersection uses only common elements, might be thought of as *.
Difference removes elements of the second set from the first, might be
thought of as -.

Examples:

A = {1,2,3,4}
B = {1,3,5,7}

A+B = {1,2,3,4,5,7}
A*B = {1,3}
A-B = {2,4}

-- 
Will Twentyman
email: wtwentyman at copper dot net


Relevant Pages

  • Re: Algorithm question
    ... We have condition A for a database and condition B for a database. ... think of is to search each element of one array in another array. ... finding all the common elements of two arrays? ... Start one pointer each at the ...
    (comp.programming)
  • Re: Algorithm question
    ... We have condition A for a database and condition B for a database. ... think of is to search each element of one array in another array. ... finding all the common elements of two arrays? ... Start one pointer each at the ...
    (comp.programming)
  • Re: Algorithm question
    ... think of is to search each element of one array in another array. ... finding all the common elements of two arrays? ... Now sort these copies using the original data as the sort key: ... Start one pointer each at the ...
    (comp.programming)
  • finding most common elements between thousands of multiple arrays.
    ... the elements are initially held in a array within an array. ... just trying to find the most common elements between all the arrays ... but with my algorithm that only takes about ... times and it seems silly to iterate through 2 million things just to ...
    (comp.lang.python)