Hi every body
I have assignment and i don't understand it
If anyone have the solution for this assignment
please help me
I am sure I will find the answers with you
So please Your Excellency me solved.
1)Source Modeling:
In this exercise you are required to explore the notion of entropy and the amount of bits required to represent a source. You are given a text file containing the United States of America’s Declaration of independence, “DecOfInd.txt”. What is the file size in bytes? Write a program to compute the frequency of the ASCII characters used in the text. Note that the text also used characters such as “full stop”, “space”, “comma”, “semi-colon”, capitals letters, etc. These are to be treated as separate symbols. Report your finding as a probability distribution table. Compute and report
the entropy of this text as the entropy of a source generating these characters. Comment on the probability distribution of the characters used in the text file. Is your expectation on the most frequently used letter of the English alphabet confirmed? On average how many bits/symbol would you expect to use in encoding this text file?
2) Entropy Coding I (Huffman Encoder/Decoder):
Given the source model (i.e. probability distribution) you have generated, write a program to implement binary Huffman encoder that will take your source model and the given text, and generate an encoded file named, “DecOfInd.huf ”. To make life easy, you can represent your binary symbol set as any arbitrary symbols, for example, ”0=a”, ”1=b”, rather than using bitwise operation to write out the encoded file (but this is your choice - you need to write it in your report though, on which choice you have taken). Report on the size of the file generated by counting the total number of symbols written to file and dividing by eight to obtain, ”size in bytes”. What compression factor were you able to achieve?
Write a program to implement the Huffman decoder. Now, use your decoder to decode your encoded file. Name your output, “DecOfInd-1.txt”. The output should be identical to the original file, “DecOfInd.txt”. What is the file size?
To check that is the case, use the UNIX/Linux command, cmp - l DecOfInd.txt DecOfInd-1.txt && ’no changes’ on the original file and decoded file. Report on the output of executing this command. You should “cut and paste” the output and insert it in your report. If your output from executing the command is too long, write it to a file and submit it. Use a reasonable file name.
3) Entropy Coding II (Adaptive Huffman Encoder/Decoder) :
Repeat the previous exercise with the Adaptive Huffman algorithm. You are to implement a binary Adaptive Huffman algorithm that will take the your source model and the given text, and generate an encoded file named, “DecOfInd.ahuf”. Then, you are to implement the Adaptive Huffman decoder as well. Name your output, “DecOfInd-ahuf-1.txt”, and again, compare it with the original file with the cmp command.
Then, cut and paste the output and insert it in your report, and answer the following questions:
What is the file size of “DecOfInd.ahuf”?
Compare and contrast the result of Adaptive Huffman and Huffman algorithm from the previous exercise, and comment on it.
4) Channel Modeling :
In the previous exercise (Entropy Coding I) you designed the binary Huffman encoder and decoder suitable for the given text file. This text will now be “transmitted” through a binary channel with a probability of bit error, p. You will simulate this channel by writing a program that inserts error into its input by inverting every bit with a probability, p.Select a value of p = 0:2 and run your program on the file, “DecOfInd.huf ”, generated in the Entropy Coding exercise. Name your output file “DecOfInd.bch1 ”. Now, use your Huffman decoder to decode the file “DecOfInd.bch1 ” into “DecOfInd-bch1.txt”. You can analyse the output by comparing it with the original text.Use the UNIX/Linux command, cmp - l DecOfInd.txt DecOfInd-bch1.txt && ’no changes’ and report the output of your execution. Reflect and comment on the output. Could you read and understand the output text, “DecOfInd-bch1.txt”?
My regards
dgtal_01
|
|
April 22nd, 2008 03:23 PM
# 2
|
Re: Who can help in my assignment, please?
Start by designing a 'counting' class (or a couple of them). You want to end up
with a collection of character, frequency pairs that form the basis of the Huffman
tree construction.
kind regards,
Jos
|
|
April 24th, 2008 04:16 AM
# 3
|
Re: Who can help in my assignment, please?
Hi Jos,
thank you for your replay
how i can start?
do you have somthing reday?
how many programs should me write in this assignment?
I have this programe from other member is it usefull for me?
1. import java.io.*;
2. import java.util.*;
3.
4. public class SourceModel
5. {
6.
7.
8. public static void main(String [] Args)
9. {
10.
11. int j;
12. String str;
13.
14. Map<Integer, Integer> m = new HashMap<Integer, Integer>();
15.
16. try
17. {
18. BufferedReader in = new BufferedReader(new FileReader("DecOfInd.txt"));
19.
20. while ((str = in.readLine()) != null)
21. {
22. for(int i = 0; i < str.length(); i++)
23. {
24.
25. if(!m.containsKey((int)str.charAt(i)))
26. {
27. m.put((int)str.charAt(i),1);
28. }
29. else
30. {
31. j = m.get((int)str.charAt(i));
32. j++;
33.
34. m.put((int)str.charAt(i),j);
35.
36. }
37.
38. }
39. }
40.
41. }
42. catch (IOException e)
43. {
44.
45. }
46.
47. System.out.println();
48. System.out.println(m.size() + " distinct letters:");
49. System.out.println(m);
50.
51. int count = 0;
52.
53. for(int i :m.keySet())
54. {
55. System.out.println(i + " = " + m.get(i));
56. count += m.get(i);
57. }
58. System.out.println("Total Number of Characters: "+count);
59.
60. }
61. }
|
|
May 14th, 2008 06:21 PM
# 10
|
Re: Who can help in my assignment, please?
yo dgtal01... if u can find this code online... that means other people in ur course can also get it.. if all of you hand up this copy of code together, this means you are copying from one another or otherwise. so i recommend you to do it out yourself instead of getting risked getting 0 marks for your assignment. this is just a piece of advice for you. up to you if you wanna listen or not...