Petrick's Method Implementation (Java)

1.4k Views Asked by At

I recently started a small project using Java to implement Quine-McCluskey's algorithm for minimizing k-maps. I've managed to do everything up until a part in Petrick's Method, where I have to distribute and simplify expressions.

Good Resource on Petrick's Method (for those who aren't familiar): link

Currently, my system outputs a neat string, like so:

(A+B)(A+D)(B+C)(D+E)(C+F)(E+F)(A+B)(A)(B+C)(C)

Another Example:

(K+L)(K+M)(L+N)(M+P)(N+Q)(P+Q)

Which would end up as:

KNP + KLPQ + LMNP + LMQ + KMNQ

My main goal is to distribute and simplify using the following of course:

  • X + XY = X
  • XX = X
  • X + X = X

I can easily do this on paper, but putting it into a working function in Java has been a whole other world to me.

Even the least bit of guidance on this matter would be much appreciated.

Thanks!

0

There are 0 best solutions below