【问题标题】:What is the correct parity for this bit sequence?这个位序列的正确奇偶校验是多少?
【发布时间】:2019-05-31 20:44:38
【问题描述】:

我有以下位序列,我正在尝试确定它的奇偶性,但我确信答案。

1010101010101011

既然 1 的个数是 9,我可以假设奇偶校验是奇数吗?

【问题讨论】:

    标签: networking parity


    【解决方案1】:

    是的。这个序列的奇偶校验是奇数,如下工具所示:

    var input = document.getElementById("bits");
    var parity = document.getElementById("parity");
    input.addEventListener("keyup", function(e) {
      this.value = this.value.replace(/[^01]/g, "");
      parity.innerText = this.value ? (this.value.match(/1/g)||[]).length % 2 ? "odd" : "even" : "";
    });
    <input id="bits"/><br />
    Parity: <span id="parity"></span>

    【讨论】:

      猜你喜欢
      • 2015-06-29
      • 2017-02-07
      • 2015-04-04
      • 2022-11-01
      • 1970-01-01
      • 2013-03-13
      • 1970-01-01
      • 2013-03-18
      相关资源
      最近更新 更多