****************IN C PROGRAMMING****************
Sometimes even the smallest change in data can make a big difference. Luckily, there are algorithms that will let us not only detect when there has been an error(like checksums), but also correct when an error has occurred. These algorithms are called error-correcting codes.There are many examples of error correcting codes but one of the simplest examples is called a parity bit. A parity bit is just a single bit (1 or 0) that indicates whether a set of values has an even number of 1s (then the bit would be set to 0), or an odd number of 1s (then the bit would be set to 1).If you have a row of 1s and 0s, you can detect whether a single bit has been changed by checking the parity bit. But this won’t tell you anything about where the error is positioned.
Consider the following array of bits:
1 0 1 0 1 0 1 1
The parity bit of this array would be 1, since there are an odd number of 1s. If a single bit changed, the parity bit would be 0 (since a 1 was either added or removed).If you have a grid of 1s and 0s, you can detect whether a single bit has been changed by checking the parity bit of each row and each column. If you find a row that’s been changed and a column that’s been changed, then you know that the bit that was changed was at the intersection of that row and column. If a single bit changed, then you would be able to find the wrong bit, based on the wrong parity bits.
For this assignment you are going to calculate the parity for a 2D matirx of bits. As example:
This is a 3 by 4 matirx.
1 0 1 0 parity = 0 since there is an even number of 1's
1 0 1 1 parity = 1 since there is an odd number of 1's
1 1 1 1 parity = 0 since there is an even numnber of 1's
----------
1 1 1 0 is the parity of the above columns of rows
Your program should output the following:
Columns of Rows Parity: 1 1 1 0
Rows of Columns Parity: 0 1 0
According to given specifications, following C program is developed.
Source code:
Filename: parity.c
#include<stdio.h>
int main()
{
int bits[10][10];
int rows, cols;
printf("\nEnter number of rows and columns of
bit-grid: ");
scanf("%d", &rows);
scanf("%d", &cols);
printf("\nEnter bits...\n");
int i, j;
for(i=0; i<rows; i++)
{
for(j=0; j<cols; j++)
{
scanf("%d", &bits[i][j]);
}
}
int rows_parity[rows];
int cols_parity[cols];
// Process all rows and store parity of each row in
rows_parity array
for(i=0; i<rows; i++)
{
int count_one = 0;
for(j=0; j<cols; j++)
{
if(bits[i][j]==1)
count_one++;
}
if(count_one%2==0)
rows_parity[i] =
0;
else
rows_parity[i] =
1;
}
// Process all columns and store parity of each
column in cols_parity array
for(j=0; j<cols; j++)
{
int count_one = 0;
for(i=0; i<rows; i++)
{
if(bits[i][j]==1)
count_one++;
}
if(count_one%2==0)
cols_parity[j] =
0;
else
cols_parity[j] =
1;
}
printf("\nColumns Parity: ");
for(i=0; i<cols; i++)
{
printf("%d ",
cols_parity[i]);
}
printf("\nRows Parity: ");
for(i=0; i<rows; i++)
{
printf("%d ",
rows_parity[i]);
}
printf("\n");
return 0;
}
Output screenshot
****************IN C PROGRAMMING**************** Sometimes even the smallest change in data can make a big difference. Luckily,...
Done in Java using Apache NetBeans IDE 11.2 -- Objectives: To create a data structure with underlying linked chain; To utilize and implement code dealing with parity big codes for error detection; To read data from file **The other answer when searching for this question does not have a ParityChain class, a ParityChainDemo class or even include some of the stated requirements (such as hasError method). **Parity bit was specified by instructor to be LEFT most bit in chain In...
**I asked this question once, and the answer completely ignored a majority of the rules listed on this. PLEASE read what is necessary before giving an answer. **NEITHER answer when searching for this question has a ParityChain class, a ParityChainDemo class or even include some of the stated requirements (such as hasError method). **Parity bit was specified by instructor to be LEFT most bit in chain Done in Java using Apache NetBeans IDE 11.2 -- Objectives: To create a data...
1. (10 points) Suppose the information content of a packet has the pattern as follows. An even parity is used. What are the values of the parity bits? Fill in the blanks. 1 1 1 0 0 1 1 0 1 0 0 1 1 1 0 1 2. (10 Points) Suppose there is a single bit error in the packet in problem 1 (see below). Show that two-dimensional parity checks can detect and correct it (by finding the row...
Question 1: Design a DFA with at most 5 states for the language L1 = {w ∈ {0, 1}∗ | w contains at most one 1 and |w| is odd}. Provide a state diagram for your DFA. Approaching the Solution --since we haven’t really practiced this type of assignment (i.e. had to define our machine based on only having the language given; not the formal 5 tuples), I am providing the steps for how to work through this; you are...
Can I get a circuit diagram of this and have the questions in it answered/explained? Thank you. TR. I. SINT400 quau AUC I. Parity. The parity of a string of bits is the least significant bit of their binary This sum is either 0 or 1, depending on whether the number of 1's is even or odd. This seems stupid, but adding a parity bit that makes the parity of every binary number being transmitted even allows one to determine...
3. DRAM: How Big Can We Make Them? Nearly all devices that include some form of computational capability (phones, tablets, gaming consoles, laptops,.. use a type of memory known as Dynamic Random Access Memory (DRAM). DRAM is where the "working set" of instructions and data for a processor is typically stored, and the ability to pack an ever increasing number of bits on to a DRAM chip at low cost has been critical to the continued growth in computational capability...
in c++ Purpose: This lab will give you experience harnessing an existing backtracking algorithm for the eight queens problem, and seeing its results displayed on your console window (that is, the location of standard output). Lab A mostly complete version of the eight queens problem has been provided for you to download. This version has the class Queens nearly completed. You are to provide missing logic for the class Queens that will enable it to create a two-dimensional array that...
Help can you do this? C programming Overview In this program, you will be taking product information in from a file, taking in sales information from a file, and calculating the new inventory quantity. Your program should also output the inventory information to a new file at the user's request. Requirements: Take in via command line arguments the names of the product info and sales files. Read in the information into an array of structures and a 2d array respectively....
PLEASE ANSWER IN C++! Given the starting point in a maze, you are to find and mark a path out of the maze, which is represented by a 20x20 array of 1s (representing hedges) and 0s (representing the foot-paths). There is only one exit from the maze (represented by E). You may move vertically or horizontally in any direction that contains a 0; you may not move into a square with a 1. If you move into the square with...
Please help i need a C++ version of this code and keep getting java versions. Please C++ only Purpose: This lab will give you experience harnessing an existing backtracking algorithm for the eight queens problem, and seeing its results displayed on your console window (that is, the location of standard output). Lab A mostly complete version of the eight queens problem has been provided for you to download. This version has the class Queens nearly completed. You are to provide...