Quine–McCluskey algorithm: Difference between revisions

Content deleted Content added
Ajmullen (talk | contribs)
CC3305 (talk | contribs)
Made the syntax of the pseudo code more consistent. Also fixed the psudeocode of the algorithm
Line 210:
'''if''' CheckDashesAlign(minterm1, minterm2) && CheckMintermDifference(minterm1, minterm2) '''then'''
mergedMinterm ← MergeMinterms(minterm1, minterm2)
'''if''' primeImplicants.Add( Does Not Contain mergedMinterm) then
primeImplicants.Add(mergedMinterm)
numberOfMerges ← numberOfMerges + 1
merges[i] ← true
Line 217 ⟶ 218:
// Filtering all minterms that have not been merged as they are prime implicants. Also removing duplicates
'''for''' j = 0 '''to''' length(minterms) '''do'''
'''if''' merges[j] == false && primeImplicants ContainsDoes Not Contain minterms[j] '''then'''
add primeImplicants.Add(minterms[j]) to primeImplicants
// if no merges have taken place then all of the prime implicants have been found so return, otherwise
Line 248 ⟶ 249:
// minterms. Examples include '01--' and '10-0'
m1, m2 '''←''' integer representation of minterm1 and minterm2 with the dashes removed, these are replaced with 0
// ^ here is a bitwise XOR
res ← m1 '''^''' m2
'''return''' res != 0 && (res & res - 1) == 0