Anonymous user
Power set: Difference between revisions
add null set behavior as extra credit
(→{{header|Perl}}: Added lower memory implementation.) |
(add null set behavior as extra credit) |
||
Line 8:
For a set which contains n elements, the corresponding power set has 2<sup>n</sup> elements, including the edge cases of [[wp:Empty_set|empty set]].<br />
The power set of the empty set is the set which contains itself (2<sup>0</sup> = 1):<br />
<math>\mathcal{P}</math>(<math>\varnothing</math>) = { <math>\varnothing</math> }<br />
And the power set of the set which contains only the empty set, has two subsets, the empty set and the set which contains the empty set (2<sup>1</sup> = 2):<br />
<math>\mathcal{P}</math>({<math>\varnothing</math>}) = { <math>\varnothing</math>, { <math>\varnothing</math> } }<br>
'''Extra credit: ''' Demonstrate that your language supports these last two powersets.
=={{header|Ada}}==
|