Question: URGENTT C PROGRAMMING i need this as fast as possible pls For data compression and other purposes, we often need to look for runs (or

URGENTT C PROGRAMMING i need this as fast as possible pls

For data compression and other purposes, we often need to look for runs (or sequences) of repeated characters in data. For example, in the string

abbbbccdeeeeef

there is a run of 4 b's, a run of 2 c's and a run of 5 e's. We also consider that the a, the d, and the f are all runs of length 1.

  1. Write a main function in C that reads a file name called a .txt, compresses the file using compressString function and stores it in b. txt.

(5 marks)

  1. Write a C function named compressString that, given an input character string, prints a possibly compressed representation of the input character string. The new representation is determined by counting the lengths of runs of a single character, as demonstrated below:
  • Given the string "abbbbccdeeeeef', compressString prints la4b2c1d5elf followed by ' '.
  • Given the string "a", compressString prints la followed by An'.
  • Given the string "zzzzzzzzzzzzzzzzzzzzzzzzzz", compressString prints 26z followed by ' '.
  • Given the string "xxbbbxx", compressString prints 2x3b2x followed by ' '.
  • Given the string "aaAa", compressstring prints 2a1Ala followed by ' '. (Uppercase and lower-case letters are different.)
  • Given the string "", compressString only prints An'.

State any assumptions that you make.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!