Skip to content

This repository contains an efficient implementation of the algorithm for generating all subsets of a given set.

License

Notifications You must be signed in to change notification settings

przemekMal/Subset-Generator

Repository files navigation

Subset Generation Algorithm

Description

This repository contains a set of MATLAB functions for working with subsets of a given set. Below are descriptions of each function

1. 'find_max_element_not_in_A(zbior, A)'

This function finds the maximum element in the set zbior that is not present in the subset A.

2. 'remove_elements_greater_than(A, a)'

This function removes elements greater than a from the subset A.

3. 'generate_subsets(zbior, A, num)'

This function generates subsets of the set zbior based on the provided parameters.

4. 'create_subset(zbior, A)'

This function creates a subset by adding the maximum element not in A to the existing subset. Example Usage

matlab

% Example usage of the subset generation algorithm
% Define the set and subset A
set = [1, 2, 3, 4, 5, 6, 7];
A = [1, 2, 3, 5];

% Define the value of n (if you want all consecutive subsets, don't pass n to the function)
n = 10;

% Generate subsets using the provided function
subsets = generate_subsets(set, A, n);

% Display the generated subsets
for i = 1:length(subsets)
    disp(subsets{i});
end

License

This project is licensed under the MIT License - see the LICENSE file for details.

Feel free to adjust the information to better fit your project's needs.

About

This repository contains an efficient implementation of the algorithm for generating all subsets of a given set.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages