All problems
BSC Rate Feasibility Check
Problem
Return True when a rate is achievable on a binary symmetric channel with crossover probability p, that is when rate < 1 - H2(p). The binary entropy H2(p) is 0 when p equals 0 or 1.
Hint
Compute the capacity 1 - H2(p) and compare it strictly with the requested rate.
Test cases
case 1
in: [0.1,0.5]
expected: true
case 2
in: [0.1,0.6]
expected: false
case 3
in: [0,1]
expected: false
case 4
in: [0.5,0]
expected: false
case 5
in: [0.25,0.2]
expected: false
Starter codePython
import math
def bsc_rate_feasible(p, rate):
# Your code here
pass5 test cases · run your code against them in the editor