ArticleslgStudy

computer science

Quine–McCluskey algorithm

Quine–McCluskey algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Quine–McCluskey algorithm rather than just read about it. In short: The Quine–McCluskey algorithm (QMC), also known as the method of prime implicants or the tabulation method, is a method used for minimization of Boolean functions that was developed by Willard V. Quine in 1952 and extended by Edward J.

Quine–McCluskey algorithm — main illustration
Quine–McCluskey algorithm — illustration

Key takeaways

  • Quine–McCluskey algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Quine–McCluskey algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Quine–McCluskey algorithm from memory before moving on to harder problems.

Reference excerpt

The Quine–McCluskey algorithm (QMC), also known as the method of prime implicants or the tabulation method, is a method used for minimization of Boolean functions that was developed by Willard V. Quine in 1952 and extended by Edward J. McCluskey in 1956. As a general principle this approach had already been demonstrated by the logician Hugh McColl in 1878, was proved by Archie Blake in 1937, and was rediscovered by Edward W. Samson and Burton E. Mills in 1954 and by Raymond J. Nelson in 1955. Also in 1955, Paul W. Abrahams and John G. Nordahl as well as Albert A. Mullin and Wayne G. Kellner proposed a decimal variant of the method. The Quine–McCluskey algorithm is functionally identical to Karnaugh mapping, but the tabular form makes it more efficient for use in computer algorithms, and it also gives a deterministic way to check that the minimal form of a Boolean F has been reached. The Quine-McCluskey algorithm works as follows:

Finding all prime implicants of the function. Use those prime implicants in a prime implicant chart to find the essential prime implicants of the function, as well as other prime implicants that are necessary to cover the function.

Complexity Although more practical than Karnaugh mapping when dealing with more than four variables, the Quine–McCluskey algorithm also has a limited range of use since the problem it solves is NP-complete. The running time of the Quine–McCluskey algorithm grows exponentially with the number of variables. For a function of n variables the number of prime implicants can be as large as 3 n / n {\displaystyle 3^{n}/{\sqrt {n}}} , e.g. for 32 variables there may be over 534 × 1012 prime implicants. Functions with a large number of variables have to be minimized with potentially non-optimal heuristic methods, of which the Espresso heuristic logic minimizer was the de facto standard in 1995. For one natural class of functions f {\displaystyle f} , the precise complexity of finding all prime implicants is better-understood: Milan Mossé, Harry Sha, and Li-Yang Tan discovered a near-optimal algorithm for finding all prime implicants of a formula in conjunctive normal form. Step two of the algorithm amounts to solving the set cover problem; NP-hard instances of this problem may occur in this algorithm step.

Example

Input In this example, the input is a Boolean function in four variables, f : { 0 , 1 } 4 → { 0 , 1 } {\displaystyle f:\{0,1\}^{4}\to \{0,1\}} which evaluates to 1 {\displaystyle 1} on the values 4 , 8 , 10 , 11 , 12 {\displaystyle 4,8,10,11,12} and 15 {\displaystyle 15} , evaluates to an unknown value on 9 {\displaystyle 9} and 14 {\displaystyle 14} , and to 0 {\displaystyle 0} everywhere else (where these integers are interpreted in their binary form for input to f {\displaystyle f} for succinctness of notation). The inputs that evaluate to 1 {\displaystyle 1} are called 'minterms'. We encode all of this information by writing

f ( A , B , C , D ) = ∑ m ( 4 , 8 , 10 , 11 , 12 , 15 ) + d ( 9 , 14 ) . {\displaystyle f(A,B,C,D)=\sum m(4,8,10,11,12,15)+d(9,14).\,}

This expression says that the output function f will be 1 for the minterms 4 , 8 , 10 , 11 , 12 {\displaystyle 4,8,10,11,12} and 15 {\displaystyle 15} (denoted by the 'm' term) and that we don't care about the output for 9 {\displaystyle 9} and 14 {\displaystyle 14} combinations (denoted by the 'd' term). The summation symbol ∑ {\displaystyle \sum } denotes the logical sum (logical OR, or disjunction) of all the terms being summed over.

Step 1: Finding the prime implicants First, we write the function as a table (where 'x' stands for don't care):

One can easily form the canonical sum of products expression from this table, simply by summing the minterms (leaving out don't-care terms) where the function evaluates to one:

fA,B,C,D = A'BC'D' + AB'C'D' + AB'CD' + AB'CD + ABC'D' + ABCD. which is not minimal. So to optimize, all minterms that evaluate to one are first placed in a minterm table. Don't-care terms are also added into this table (names in parentheses), so they can be combined with minterms:

At this point, one can start combining minterms with other minterms in adjacent groups; as in, we compare minterms in nth group with (n+1)th group. So for the m4 minterm in with only one Number of 1s, we compare it to m9, m10, and m12 which have two Number of 1s. If two terms differ by only a single digit, that digit is replaced with a dash indicating that the digit doesn't matter. For instance 1000 and 1001 can be combined to give 100-, indicating that both minterms imply the first digit is 1 and the next two are 0. Terms that can't be combined any more are marked with an asterisk (*).

… excerpt ends here. Continue reading the full article.

Illustrations

Quine–McCluskey algorithm: Hasse diagram of the search graph of the algorithm for 3 variables. Given e.g. the subset 
  
    
      
        S
        =
        {
        a
        b
        c
        ,
        a
        
          
            b
            ¯
          
        
        c
        ,
        
          
            a
            ¯
          
        
        b
        c
        ,
        
          
            a
            ¯
          
        
        b
        
          
            c
            ¯
          
        
        ,
        
          
            a
            ¯
          
        
        
          
            b
            ¯
          
        
        c
        }
      
    
    {\displaystyle S=\{abc,a{\overline {b}}c,{\overline {a}}bc,{\overline {a}}b{\overline {c}},{\overline {a}}{\overline {b}}c\}}
  
 of the bottom-level nodes (light green), the algorithm computes a minimal set of nodes (here: 
  
    
      
        {
        
          
            a
            ¯
          
        
        b
        ,
        c
        }
      
    
    {\displaystyle \{{\overline {a}}b,c\}}
  
, dark green) that covers exactly 
  
    
      
        S
      
    
    {\displaystyle S}
  
.
Hasse diagram of the search graph of the algorithm for 3 variables. Given e.g. the subset S = { a b c , a b ¯ c , a ¯ b c , a ¯ b c ¯ , a ¯ b ¯ c } {\displaystyle S=\{abc,a{\overline {b}}c,{\overline {a}}bc,{\overline {a}}b{\overline {c}},{\overline {a}}{\overline {b}}c\}} of the bottom-level nodes (light green), the algorithm computes a minimal set of nodes (here: { a ¯ b , c } {\displaystyle \{{\overline {a}}b,c\}} , dark green) that covers exactly S {\displaystyle S} .

Worked examples

Example 1 — a first encounter with Quine–McCluskey algorithm

Start with the simplest possible case. Write down what Quine–McCluskey algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Quine–McCluskey algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Quine–McCluskey algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Quine–McCluskey algorithm

In research
Quine–McCluskey algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Quine–McCluskey algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Quine–McCluskey algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Boolean algebra, Willard Van Orman Quine, so understanding it makes those chapters shorter.
In everyday life
Look for Quine–McCluskey algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Quine–McCluskey algorithm” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Quine–McCluskey algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Quine–McCluskey algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Quine–McCluskey algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Quine–McCluskey algorithm in simple terms?

The Quine–McCluskey algorithm (QMC), also known as the method of prime implicants or the tabulation method, is a method used for minimization of Boolean functions that was developed by Willard V. Quine in 1952 and extended by Edward J.

Why does Quine–McCluskey algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Quine–McCluskey algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Quine–McCluskey algorithm.

Tags

  • Boolean algebra
  • Willard Van Orman Quine

Keep exploring