Answer the question
In order to leave comments, you need to log in
How to do an analysis of binary codes for the possibility of detection?
Guys, hello. I just started to study the pros, I decided to go the way of a freelancer. Decided to go from complex to simple. I faced a task that sounds like this
- "Analysis of binary codes for the possibility of detecting and correcting n-fold errors
(based on the concept of a matrix of code distances, code words are generated or entered from the keyboard)"
Does anyone have sources for creating such a code? Maybe literature? Maybe create your own methods like this? I ask for help, as a newfag in this language (
Answer the question
In order to leave comments, you need to log in
Let's just say - this task does not apply directly to the pluses. There is more about algorithmization, mathematics, and that's it. And language is just a tool. So take Google and read about "correction codes" and so on.
naive hamming encoder
output columns:
binary code | its decimal representation | encoded number
N = 64 means 6-bit word, N = 256 - 8-bit
M = 3 - the number of bits in which each code differs from the rest
, feel free to experiment with them.
function diff(a, b) {
return (a ^= b).toString(2).replace('0', '').length
}
const N = 64, M = 3, res = [];
for (let i = 0; i < N; i++) {
let flag = true;
for (let n of res) {
if (diff(i, n) < M) {
flag = false
break;
}
}
if (flag) {
console.log((i + N).toString(2).slice(1), i, res.length);
res.push(i);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question