logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Persimmon BissoondathBusiness
(4/5)

847 Answers

Hire Me
expert
Ruth FrameLaw
(5/5)

827 Answers

Hire Me
expert
Neil BissonnetteeCriminology
(5/5)

510 Answers

Hire Me
expert
Alejandro PerryEngineering
(5/5)

523 Answers

Hire Me
C++ Programming

you will create a parallel fixed-length code generator using the tools we learned in class to create multiple processes and threads.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Programming Assignment

Requested files: main.cpp, FixedLengthCoder.h, FixedLengthCoder.cpp

Problem:

For this assignment, you will create a parallel fixed-length code generator using the tools we learned in class to create multiple processes and threads.

Computers represent a character as a sequence of 8 bits, which means that you can represent up to 256 symbols per character. However, depending on the source, it is common to have messages/files using an alphabet with a size of fewer than 256 symbols.

The simplest way to achieve compression is to use a fixed-length code generator. The idea behind this type of code generators is to assign a fixed-length bit sequence to each symbol of the alphabet.

You need to implement a fixed-length code generator based on the following steps:

  1. Read the contents of a text file (the filename will be given as a command line argument).
  2. Generate the alphabet used in the input file and determine the frequency and the first position for each symbol in the alphabet.
  3. Sort the alphabet in decreasing order based on the frequency of the symbols. If two or more symbols have the same frequency, you will use the ASCII value of the symbol to break the tie.
  4. Assign the code to the symbols in the alphabet. For each symbol in the alphabet, you must create a process or a thread to generate its code. You must guarantee that each symbol has the same number of bits. To calculate the number of bits used per symbol you will use the following formula: ceil(log2(size of the alphabet)).
  5. Print the codes of the symbols in the alphabet sorted in increasing order by their first appearance in the input file.

NOTES:

    • You must select the appropriate tool the implement the parallel code generator. Not using multiple threads or multiple processes will translate into a penalty of 100%.
    • You must use forks and parent/child threads, or you will get 0%.
    • You must use the output statement format based on the example below. To guarantee consistency when printing the characters of the alphabet to STDOUT, replace the '\n' character with the string "<EOL>".
    • You can implement your solution only using the requested file main.cpp (you do not need to use the provided files to implement an OOP based solution).
    • You can safely assume that the input will always be valid. 

EXAMPLE:

Input file contents:

aaaeeiaaeeiiioouuuuuuuua

Expected output:

Symbol: a, Frequency: 6, Code: 001

Symbol: e, Frequency: 4, Code: 011

Symbol: i, Frequency: 4, Code: 010

Symbol: o, Frequency: 2, Code: 100

Symbol: u, Frequency: 8, Code: 000

 

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

436 Experts Online