Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating algorithms to determine the size of subsets in a power set
    text
    copied!<p>I am having trouble creating algorithms for this assignment. I would be grateful if I could get some hints on who to start on the first algorithm.</p> <p>The goal of this assignment is to implement and compare various algorithms for calculating the number of subsets of every possible size for a given set. Remember that a set with n elements has 2^n subsets. Two of the algorithms will be used to actually generate the subsets. Your program will have the capability of asking the user for choices until he/she wishes to exit. A GUI for your program is permitted, but not required. The choices should allow the following:</p> <ol> <li>Run an algorithm that works based on counting all 2^n whole numbers starting at 0 (you may not be able to use the C/C++/Java int data type) and determining the size of the subset corresponding to each number. This algorithm must use whole number division and modulus in some way. It needs to return an array holding the numbers of subsets of each possible size. Display the numbers of subsets of each possible size. The value of n will be determined by user input. Error checking should be performed on n.</li> <li><p>Run an algorithm that works based on counting all 2^n whole numbers starting at 0 (you may not be able to use the C/C++/Java int data type) and determining the size of the subset corresponding to each number. This algorithm must use bit-level operations (logical and and shift) in some way. It needs to return an array holding the numbers of subsets of each possible size. Display the numbers of subsets of each possible size. The value of n will be determined by user input. Error checking should be performed on n.</p></li> <li><p>Run an algorithm that generates C(n,k) for all values of k between 0 and n (inclusive), where n is determined by user input. This algorithm needs to utilize a recursive factorial function. It needs to return an array holding the numbers of subsets of each possible size. Display the numbers of subsets of each possible size. Error checking should be performed on n.</p></li> <li><p>Run an algorithm that generates C(n,k) for all values of k between 0 and n (inclusive), where n is determined by user input. This algorithm needs to utilize an iterative factorial algorithm. It needs to return an array holding the numbers of subsets of each possible size. Display the numbers of subsets of each possible size. Error checking should be performed on n.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload