Problem

Static dictionary techniques are characterized by using a predefined dictionary of pattern...

Static dictionary techniques are characterized by using a predefined dictionary of patterns encoded with unique codewords. After a dictionary is established, the problem of using it most efficiently still remains. For example, for a dictionary = {ability, ility, pec, re, res, spect, tab}, the word respectability can be broken down in two ways: res, pec, tab, ility and re, spect, ability; that is, the first division requires four codewords for this word, whereas the second requires only three. The algorithm parses the word or words and determines which of the two choices will be made. Of course, for a large dictionary, there may be more than two possible parsings of the same word or phrase. By far the most frequently used technique is a greedy algorithm that finds the longest match in the dictionary. For our example, the match res is longer than re; therefore, the word respectability is divided into four components with the greedy strategy. An optimal parsing can be found by adapting a shortest path algorithm (Bell, Cleary, and Witten 1990; Schuegraf and Heaps 1974). Write a program that for a dictionary of patterns compresses a text file. For each string s, create a digraph with length(s) nodes. Edges are labeled with the dictionary patterns, and their codeword lengths are edges’ costs. Two nodes i and j are connected with an edge if the dictionary contains a pattern s[i] . . . s[j–1]. The shortest path represents the shortest sequences of codewords for patterns found in the path.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 11
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT