GithubHelp home page GithubHelp logo

algebra--generate-all-partition-s-of-a-set's Introduction

Generate all partition's of a set and the set of equivalence relations

This is a bonus problem for the Algebra course at the UBB University

About the source code

To represent a partition, we will use a vector of integers, each integer representing the number of the subset in which the corresponding element is in

Partitioning -> Encoding

  • {1, 2, 3} -> (1, 1, 1)
  • {1} {2, 3} -> (2, 1, 1)
  • {2} {1, 3} -> (1, 2, 1)
  • {1, 2} {3} -> (2, 2, 1)
  • {1} {2} {3} -> (3, 2, 1)

If we write the encodings backwards we obtain:

  • 111
  • 112
  • 121
  • 122
  • 123

Be aware that the number 113 is missing because the encodings 112 and 113 translate to the same partitions

So, for a partition we just need to generate all the numbers with n-1 "digits" and the difference between the biggest two digits should be 1

If the number of elements of the set is to big(>10) we generate only the number of partitions of that set using Bell's triangle

algebra--generate-all-partition-s-of-a-set's People

Contributors

alexnaiman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.