Question

This is a question about tries and compression in an algorithms course i'm taking.Problem 7. Give the LZW encoding the string all consisting of N repeats of the character a. What is the compression ratio as

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I am attaching the code of the compression :

Oct 30 9:35 PM Activities Google Chrome M Inbox (5,203) - rshzb 14.7© x M Activation mail - Login an x f → e onlinegdb.com/onOct 30 9:35 PM Activities Google Chrome M Inbox (5,203) - rshzb 14.7© x M Activation mail - Login an x f → e onlinegdb.com/onThe output is also given.


answered by: ANURANJAN SARSAM
Add a comment
Answer #2

I am attaching the code of the compression :

Oct 30 9:35 PM Activities Google Chrome M Inbox (5,203) - rshzb 14.7© x M Activation mail - Login an x f → e onlinegdb.com/onOct 30 9:35 PM Activities Google Chrome M Inbox (5,203) - rshzb 14.7© x M Activation mail - Login an x f → e onlinegdb.com/onThe output is also given.

Add a comment
Know the answer?
Add Answer to:
This is a question about tries and compression in an algorithms course i'm taking. Problem 7....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I have a little problem about my code. when i'm working on "toString method" in "Course"...

    I have a little problem about my code. when i'm working on "toString method" in "Course" class, it always say there is a mistake, but i can not fix it: Student class: public class Student {    private String firstName;    private String lastName;    private String id;    private boolean tuitionPaid;       public Student(String firstName, String lastName, String id, boolean tuitionPaid)    {        this.firstName=firstName;        this.lastName=lastName;        this.id=id;        this.tuitionPaid=tuitionPaid;    }   ...

  • JAVA: Run length encoding is a simple form of data compression. It replaces long sequences of...

    JAVA: Run length encoding is a simple form of data compression. It replaces long sequences of a repeated value with one occurrence of the value and a count of how many times to repeat it. This works reasonably well when there are lots of long repeats such as in black and white images. To avoid having to represent non-repeated runs with a count of 1 and the value, a special value is often used to indicate a run and everything...

  • Hello, I'm taking signal systems course. please solve this question in matlab as soon as possbile please. Question 1 a) Write a function that calculates the Continuous Time Fourier Transform o...

    Hello, I'm taking signal systems course. please solve this question in matlab as soon as possbile please. Question 1 a) Write a function that calculates the Continuous Time Fourier Transform of a periodic signal x() Syntax: [w, X] = CTFT(t, x) The outputs to the function are: w = the frequencies in rad/s, and X = the continuous Fourier transform of the signal The inputs to the function are: x-one period of the signal x(t), andt the time vector The...

  • Using the result of exercise 7(see question 7 below), give algorithms for generating random variables from...

    Using the result of exercise 7(see question 7 below), give algorithms for generating random variables from the following distributions. b. 1-2 if 0<<1 7. (The Composition Method) Suppose it is relatively easy to generate random variables from any of the distributions F,,-I, . . . , n. How could we generate a random variable having the distribution function 12 i-1 where p,, -1.... . n, are nonnegative numbers whose sum is 1?

  • Tried numerous times but I think I'm doing this problem wrong. Will give thumb's up for...

    Tried numerous times but I think I'm doing this problem wrong. Will give thumb's up for help. JAVA starter code: import java.util.Scanner; public class ArraySorter { public static void main(String[] args) { Scanner sc = new Scanner(System.in);    // Read in k, which represents the maximum // distance between a number's current position // and sorted position int k = Integer.parseInt(sc.nextLine());    // Read in the list of numbers int[] numbers; String input = sc.nextLine(); if (input.equals("")) { numbers =...

  • Hi everyone, I have a problem about C programming. Background Material: The figure 6 is as...

    Hi everyone, I have a problem about C programming. Background Material: The figure 6 is as below: The task: Download the file 55.c. Study the C code, then build an executable and run it to see what the output is. Modify the program so that the output is The string in buffer is "In C the value of 12 + 34 / 5 is 18." Do this by looking up decimal values for ASCII codes in Figure 6 and typing...

  • Hey! I'm really unsure about all these answers! Could you please check and explain each one?...

    Hey! I'm really unsure about all these answers! Could you please check and explain each one? We were unable to transcribe this imageU Question 2 1 pts A standing wave is created on a stretched string as shown below. What harmonic has been created in the string? First O Second Fourth O Third Question 3 2 pts 45 Astring of length L-1.2m is attached at one end to a wave oscillator, which is vibrating at f=80 Hz. The other end...

  • Question 4 (10 marks) When analysing the complexity of algorithms, there are three main approaches: worst case, best ca...

    Question 4 (10 marks) When analysing the complexity of algorithms, there are three main approaches: worst case, best case and average case. As an example, consider measuring the complexity of list-merging by counting the number of comparisons used As a test example, assume the following A1: There are two ordered lists, each of length 4, say A2: Neither list contains repeats, so a! < a2 < аз < a4 and bl <b2 < b3 < b4 A3: The lists are...

  • Please provide reference to each question 4.         Mary has been taking methotrexate for about 4 months...

    Please provide reference to each question 4.         Mary has been taking methotrexate for about 4 months (along with naproxen as needed). She is currently taking 15mg weekly but her RA is not under control yet and she been feeling really rough the past few days with a sore throat and a cough developing. It’s the weekend and she can’t reach her rheumatologist so she stops at your pharmacy. Should she stop taking MTX? 5.         Mary (above) is taking irregular...

  • Select all true statements about Python string indexing: Python uses indexing operator (square br...

    Select all true statements about Python string indexing: Python uses indexing operator (square brackets) to select a single character from a string Python supports indexing in both left to right and right to left Left to right indexing starts with 0 Right to left indexing starts with -1 The return type of a string index is also a string Select all the ways you can extract "rocks" out of s = "Python rocks": print(s[7:]) print(s[7:20]) print(s[-5:]) print(s[-5::1]) print(s[-5::]) Given the...

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
ADVERTISEMENT
ADVERTISEMENT