Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ For this assignment, you will create a parallel Fibonacci code generator using multiple processes and threads. In mathematics and computing, Fibonacci coding is

In C++

For this assignment, you will create a parallel Fibonacci code generator using multiple processes and threads.

In mathematics and computing, Fibonacci coding is a universal code that encodes positive integers into binary code words. It is one example of representations of integers based on Fibonacci numbers. Each codeword ends with "11" and contains no other instances of "11" before the end.

You need to implement a parallel Fibonacci code generator based on the following steps:

  1. Read the alphabet of the original message (string) and the name of the input file (string) from STDIN.
  2. Calculate the frequency of the symbols in the alphabet in the input file. For each symbol in the alphabet, you must create a child process or a thread to calculate the assigned symbol's frequency.
  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 symbol's ASCII value to break the tie (the higher the value, the higher the priority).
  4. Assign a positive integer value (starting from 1) to the symbols in the sorted alphabet. For each symbol in the alphabet, you must create a process or a thread to generate its Fibinnaci code based on the assigned integer value.
  5. Print the codes of the symbols in the alphabet sorted in increasing order by their ASCII value.

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 the output statement format based on the example below.
  • 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:

STDIN input:
aeiou input1.txt 
input1.txt content:
aaaeeeiiiooouuuuuuuuuuuuuuuuaaeeeeeeeiiiiiiiiiiiiiiiiiiiiiiiiiiiiaaaaa
Expected output: 
 

Symbol: a, Frequency: 10, Code: 1011 Symbol: e, Frequency: 10, Code: 0011 Symbol: i, Frequency: 31, Code: 11 Symbol: o, Frequency: 3, Code: 00011 Symbol: u, Frequency: 16, Code: 011

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

=+3 In what ways can an MNE improve or change its approach to IHRM?

Answered: 1 week ago