Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If you look at some compression techniques (such as LZW Compression https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch ) they make use of the concept of hashing techniques to compress files.

If you look at some compression techniques (such as LZW Compression https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch ) they make use of the concept of hashing techniques to compress files. We are going to do something similar. Consider the phrase

To be or not to be, that is the question.

Even though it does not make much sense to do this as the phrase is short. We are going to create bins for each word, and record the position of the instances of the words in the proper bins. So write a program that first has a series of bins

to

be

or

not

etc.

Because the word to occurs in positions 1 and 5, the bin for the word to will contain 1 and 5

to: 1 5

be: 2 6

or: 3

Write an program that will take the phrase, create bins for each word, and then record the instance position of each word in the bin. It will then output each bin (word) and the locations of the word in the phrase. So if the input was;

I want what I want and I know what I want.

The output would be;

I: 1 4 7 10

want: 2 5 11

what: 3 9

and: 6

know: 8

I have created a JSFiddle Shell to get you started that is here http://jsfiddle.net/reaglin/rm96Luws/

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 3 Lnai 9853

Authors: Bettina Berendt ,Bjorn Bringmann ,Elisa Fromont ,Gemma Garriga ,Pauli Miettinen ,Nikolaj Tatti ,Volker Tresp

1st Edition

3319461303, 978-3319461304

More Books

Students also viewed these Databases questions

Question

Evaluate the impact of unions on nurses and physicians.

Answered: 1 week ago

Question

Describe the impact of strikes on patient care.

Answered: 1 week ago

Question

Evaluate long-term care insurance.

Answered: 1 week ago