🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: att.lang.c++
Article #188

Re: Please Help with this

#188
From: Sam Sutherland
Date: Sun, 25 Apr 1999 00:00
48 lines
1726 bytes
To show that I know what I need to do, (but just can't do it) here's some
psuedo code I'm trying to turn into real code for the program in my original
message. Hopefully this is easier for someone. ??  Thanks-  samantha

REMOVE element y from set A

for(each element x in set A) {
  if(x equals y) {
    // delete x if necessary, e.g., for char * case
    for(i = index of x + 1 up to size - 1) {
      copy element i to element i-1
    }
    set size to size-1
  }
}

INTERSECTION of set A and set B

create new set C
for(each element x in set A) {
  for(each element y in set B) {
    if(x equals y) {
      add x to set C
    }
  }
}

DIFFERENCE of set A and set B

create new set C
for(each element x in set A) {
  set flag to true
  for(each element y in set B) {
    if(x equals y) {
      set flag to false
    }
  }
  if(flag is true) {
    add x to set C
  }
}



Sam Sutherland wrote in message <7g07gb$n9p$1@autumn.news.rcn.net>...
>If anybody can contribute just one of the mentioned functions (Remove,
>Intersection, Difference), even that would make me happy. thx
>
Technical Details
Message-ID: <7g0b2q$ie6$1@autumn.news.rcn.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7g02uo$mrt$1@autumn.news.rcn.net> <7g07gb$n9p$1@autumn.news.rcn.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d4ba,106607ba857ed8a6
X-Google-Attributes: gid10d4ba,public
From: "Sam Sutherland" <samantha_sutherl@hotmail.com>
Subject: Re: Please Help with this
Date: 1999/04/25
Message-ID: <7g0b2q$ie6$1@autumn.news.rcn.net>
X-Deja-AN: 470851021
References: <7g02uo$mrt$1@autumn.news.rcn.net> <7g07gb$n9p$1@autumn.news.rcn.net>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-Complaints-To: abuse@rcn.com
X-Trace: xPWMw2J2zLtHcLvBP4F0+S+pdqqX787EUnZv1WTqrNk=
NNTP-Posting-Date: 26 Apr 1999 00:13:14 GMT
Newsgroups: att.lang.c++