Programming Contest Solutions Archive
Return-Path: <408d050@linux1.ma.utexas.edu>
Received: from smtp.utexas.edu ([128.83.126.2]) by sby.mega.net.id
          (Netscape Mail Server v1.1) with SMTP id AAA57
          for <yogy-n@sby.mega.net.id> Sat, 28 Sep 1996 05:03:15 +0700
Received: (qmail-queue invoked by uid 0); 27 Sep 1996 21:58:13 -0000
Received: from unknown (HELO mail.utexas.edu) (128.83.126.1)
  by smtp.utexas.edu with SMTP; 27 Sep 1996 21:56:36 -0000
Received: from parthenon.ma.utexas.edu (parthenon.ma.utexas.edu [128.83.133.40]) 
          by mail.utexas.edu (8.6.9/8.6.6) with SMTP id PAA11950 for 
          <yogy-n@sby.mega.net.id>; Fri, 27 Sep 1996 15:23:11 -0500
Date: Fri, 27 Sep 1996 15:19:43 -0500 (CDT)
From: Michael Permana <408d050@linux1.ma.utexas.edu>
X-Sender: 408d050@parthenon.ma.utexas.edu
To: yogy-n <yogy-n@sby.mega.net.id>
Subject: Re: Invitation
In-Reply-To: <19960926151037555.AAA134@sby72.mega.net.id>
Message-ID: <Pine.SUN.3.91.960927150931.12167B-100000@parthenon.ma.utexas.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII



On Thu, 26 Sep 1996, yogy-n wrote:

> >I'll play !
> 
> I'll tell Yuppie ;)
> 
> And, say thanks for your mother for posting me some photos. I really
> appreciate that ;)
> 
> By the way, do you still remember the problem Counting Subsets?
> 
> {}      = 1
> 1       = 2
> 1,2     = 3
> 1,2,3   = 4
> 1,3     = 5
> 2       = 6
> 2,3     = 7
> 3       = 8
there was no algortihm it's all just iteration, mm, i forgot too, strange 
isn't it. but I'll try. 
How do you think of the solution? How does your brain work.
Mine: 'I think there's a pattern in that subset'
try a larger subset too get more clearer revealation 
let's try {1,2,3,4,5}
 0: {}
 1: {1}
 2: {1,2}
 3: {1,2,3}
 4: {1,2,3,4}
 5: {1,2,3,4,5}
 6: {1,2,3,5}
 7: {1,2,4}
 8: {1,2,4,5}
 9: {1,2,5}
10: {1,3,4,5}
11: {1,4,5}
12: {1,3}
13: {1,4}
14: {1,5}
15: {2}
16: {3}
17: {4}
18: {5}
ok, I'm tired & confused now.
Let's get back to the easier one
0: {}
1: {1}
2: {1}
3: {1}
4: {1}
5: {2}
6: {2}
7: {3}
getting to it yet?

let's try this one:
n(subset) = numer ofelements in subset (3 here)
let x be 2^(n(subset)-1)

y = subset to check

example: {2,3}

answer=0

ok get the first element
is there no more element? {yes->ok the answer is x then;no-> goon read 
these bull shit} it's 2 = e
i = 1;
x = 4;
is i = e ?
no, add answer by x
ok
shr x, 1
inc(i)
is i = e
ok, i got it !
get next element
go back to top side 

I think you've already got it before you reach this line ?

1
1 2
1 2 3   
1 3

2
2 3


3

see ?? ? ??

> I forgot the algorithm. Can you help me refresh my mind on that? :)
> 
> Ciaoo! :)
> 
> 
> ==========================================================
> | Yogy Namara <yogy-n@sby.mega.net.id>                   |
> | Raya Darmo Indah K 7 Surabaya Indonesia +62-31-715714  |
> | URL <http://www.oocities.org/SiliconValley/Park/4488> |
> ==========================================================
> 
> 
>