Question 1



Question 2

Answer to question 1
It is not given what language to use for the program. Here is a python program to implement the count of non-repeated characters. The idea is to use a Hash structure(such as dictionary).
get an input string inp = input().strip() # initialize an empty set s = set() # iterate through each character in inp # insert into the set for ch in inp: s.add(ch) # a set stores unique elements # duplicacies are automatically removed print(len(s))
Sample Output Screenshot:


Answer to question 2
Step 1
Compression of Data
Data compression is the process of encoding, reorganizing, or otherwise modifying data in order to reduce its size. The data is essentially re-encoded using fewer bits than the original form.
Step 2
Compression is accomplished by the use of a computer that employs features or an algorithm to determine the most efficient way to minimize the size of the data. For instance, an algorithm can represent a string of bits with a smaller string of bits by utilizing a reference dictionary’ to convert between them. Another example is a formula that contains a reference or pointer to a string of data that the computer has already seen. This is also evident in image compression.
A nice illustration of this is always the image compression. When you locate a series of colors in the image, such as ‘Blue, Red, Red, Blue,’ the algorithm will convert this data string to a single bit.
Rather than introducing a single character into the reference string to represent repeated characters, a smaller bit string is typically eliminated, which is replaced by a single text compression. When done correctly, data compression can efficiently reduce the size of a text file by 50% or more, greatly reducing its total size.
Data compression enables the rapid transmission of a data object or file over a network or the Internet and the optimization of physical storage resources.
Data compression is a frequently used technique in computer services and solutions, most notably in data transport. Data compression utilizes a variety of compression methods and software solutions, utilizing data compression algorithms to reduce data size.
Repetitive data components and symbols are eliminated and replaced with a standard data compression technology to reduce data size. Data compression may be loosely compressed data, in which the former saves all replacements but deletes all repeating data.
Step 3
B)
When choose between these two strategies, it is critical to grasp their relative strengths and weaknesses:
Lossless Compression: Eliminates bits by locating and removing statistical redundancies. This approach does not truly remove any data. Additionally, lossless compression has a higher compression ratio, which ensures that no data in the file is lost. This is also critical when maintaining perfect quality, such as with databases or professional media. The FLAC and PNG formats both provide lossless compression.
Lossy Compression: Reduces the amount of existing data by deleting superfluous data and simplifying it. Compression using lossy algorithms can yield much higher compression ratios at the tradeoff of possible file quality degradation. JPEG supports lossy compression, whereas MP3 is based on lossy compression.
Step 4
C) Compression of Data
Compression is a technique for transforming data and reducing its size by intensity. It is advantageous since it conserves resources such as bandwidth and storage space (when transferring data). It employs an encoder that decreases the number of bits necessary to store the data to its original representation. When utilizing compressed data, they must first be decompressed. When developing a data compression method, it is critical to consider significant elements such as the desired amount of compression, the distortion of the compression system, and the computing and hardware resources required for compression and decompression. Particularly when it comes to video decompression
Encrypting Data
Encryption is a technique for transforming data to keep it private. Encryption is accomplished by employing a cipher algorithm, which can be utilized only in conjunction with a unique key. The term “ciphertext” refers to encrypted data, whereas “decryption” refers to the process of recovering the original data. Encryption is required if information must be protected from third parties, much more so when communicating via an untrustworthy medium such as the internet. Modern encryption techniques strive to produce encryption algorithms that are computationally challenging to crack.
⦁ While data compression and encryption are all methods for transferring data to various formats, goals are unique.
⦁ Data compression is used to reduce the size of the data, while encryption is used to keep the data secure from outside parties.
Incapable of decrypting encrypted data simply.
⦁ A particular piece of data known as a key must be possessed. While uncompressed data does not require such particular information (for example, a key), it may require some specialized technology depending on the data type.