- #1
transgalactic
- 1,395
- 0
i tried to follow this recurstion
but instead of getting the resolt i expected i got
some thing really different
http://img185.imageshack.us/my.php?image=img8290nf7.jpg
i entered (2,abcd)
i was supposed to get
cd
bd
bc
ad
ac
ab
istead i got some other answer using this diagram
can you tell me where i got ot wrong??
[ February 14, 2008: Message edited by: donaldth smithts ]
but instead of getting the resolt i expected i got
some thing really different
http://img185.imageshack.us/my.php?image=img8290nf7.jpg
Code:
// print all subsets of 1...n
Public static void subsets(int n, String andAlso)
{
if (n==0)
{
System.out.println(andAlso);
}
else
{
subsets(n-1,andAlso + n);
subsets(n-1,andAlso);
}
}
i entered (2,abcd)
i was supposed to get
cd
bd
bc
ad
ac
ab
istead i got some other answer using this diagram
can you tell me where i got ot wrong??
[ February 14, 2008: Message edited by: donaldth smithts ]