Assume a flash memory can have 6 levels {0, 1, 2, 3, 4, 5} and the errors can be of limited value of magnitude 1 (i.e. a digit at level i can change to level (i 1) (mod 6)). With one digit we can choose {0, 2, 4} as the codewords to have a perfect error correcting code of limited magnitude 1. With two digits, what is the maximum number codewords in a limited mag- nitude 1 perfect error correcting code

Respuesta :

Answer:

Explanation:

/* General Code for achieving perfect error for any level and any

digit of codewords*/

#include<iostream>

using namespace std;

int main(){

  int level;

  //Input memory levels.

  cout <<" Enter number of Flash Memory levels : ";

  cin>>level;

  //construct array store levels.

  int lvl[level];

  for(int i = 0; i < level; i++){

      //assign levels name

      lvl[i] = i;

  }

  int digit;

  cout << "Enter number of digit codewords :";

  //Taking input of codeword digits

  cin >> digit;

  for(int i = 0; i < level;){

      //output Codeword

      cout << lvl[i];

      //Skipping for n number digit codeword in level

      i+=(digit+1);

     

  }

 

}

/*

a) i from 0 to (i = i+(2+1))<levels

b) for length (1) -> 3 codewords

  codewords -> {0,2,4}

for length (2) -> 2 codewords

codewords -> {0,3}

*/