Reference no: EM132168005
Description: In this assignment, you are going to implement runlength encoding and decoding. In addition, the runlength code needs to write/read to/from a file. The encoding and decoding guidelines are provided as follows
In Encoding
1. First, you need to reordering the data matrix C in a zig zag way.
2. Print out the data in zig zag order
3. Count the consecutive occurrence
4. Print out the value and its consecutive occurrence
5. Open the file and Save the sequence to a file in binary mode as
- If the value is positive, the sign is 0; otherwise 1
- Save the sign using 1 bit
- Save the occurrence using 7 bits
- Save the absolute value using 8 bits (K bits in general)
- Flush the buffer
- Close the file
In Decoding
6. Open the file and Read the sequence from the file in binary mode as
- Read sign (1 bit)
- Read occurrence (7 bits)
- Read value (8 bits - K bits in general) and correct the sign
- Repeat until the end of file
- Close the file
7. Store the sequence back to data
8. Print out the sequence
9. Finally, reverse the zig zag data back to a matrix.
10. PrintMatrix C2 where C2 is the reconstructed matrix
Attachment:- Assignment.rar
How business law concepts apply today or in the future
: What new developments do you think will present the need to rethink and re-evaluate how business law concepts apply today or in the future?
|
How many users per year are needed to justify the road
: A road costs $450,000 to build and $12,000 per year for street cleaning. The road is re-striped every 2 years for $28,000 and repaved every 10 years.
|
Both hard and soft controls may be used at organization
: Both hard and soft controls may be used at an organization. An example of a hard control is...
|
Accountability from the marketing function
: Why are companies pushing for more accountability from the marketing function?
|
Implement runlength encoding and decoding
: Implement runlength encoding and decoding. In addition, the runlength code needs to write/read to/from a file. The encoding and decoding guidelines
|
Implications for american society in terms of economic trend
: The 1920s introduced many modern conveniences, such as the widespread use of the washing machine, and many modern ideas, such as buying on credit.
|
How would on define a good decision
: 1. How would on define a good decision? what is the logic behind it? 2. what are similarities and distinctions between management and leadership?
|
Find the after-tax cash flow
: The purchase of a minicomputer is being considered. The corporation's taxable income exceeds $25 million. The first cost is $19,000, maintenance is $4500 per.
|
What tax is paid in the given situation
: If the office is closed early in year 6 and the furniture is sold to a secondhand office furniture store for 10% of its initial cost, what tax is paid?
|