Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-202

Plotkin Bound

Problem

Return the Plotkin upper bound on the number of codewords of a binary code of length n and minimum distance d. When 2d > n the bound is floor(2d / (2d - n)); otherwise return 0 because the bound does not apply.

Hint

The Plotkin bound is powerful when the minimum distance exceeds half the block length.

Test cases

case 1
in: [7,4]
expected: 8
case 2
in: [7,5]
expected: 3
case 3
in: [15,8]
expected: 16
case 4
in: [5,3]
expected: 6
case 5
in: [4,2]
expected: 0
Starter codePython
def plotkin_bound(n, d):
    # Your code here
    pass

5 test cases · run your code against them in the editor