|
Hello my name is Nicolas Khoury, and I have a huge Text compression project to solve, and I'm having a hard time with it. I have all the predefined classes that I need to use, I just don't know what to do. Is there anyone who can give me their e-mail so I can upload the assignment and the classes and help me build the code? if so, please reply to my e-mail: nee-kow@hotmail.com
|
|
|
|
|
nee-kow wrote: Is there anyone who can give me their e-mail so I can upload the assignment
No, I'm afraid this site does not generally work like that. However you could try posting your question in the Collaboration & Beta Testing[^] forum.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I assume you didn't do the pre-defined classes yourself. Why don't you ask you teacher/lecturer for some help - or maybe start paying more attention in lessons (if you actually go to them)
asking someone else to do your assignments for you is just stupid. If your going down that route then I suggest a career change. Go and do something your actually capable/interested in learning because your just wasting your life (and other peoples) at the minute.
return 5;
|
|
|
|
|
Thank you for for lecture mister Musefan I do appreciate it. However, I need to remind that I am a 20 year old grown man. and I'm a computer engineering student with a GPA of 3.7 in one of the best engineering schools in my country . YES I'm on the distinction list. The point of my thread is to help me get started with the damn project because we didn't acquire much information about the binary trees. Instead of whining to my teacher I thought I'd get a little help from some fellow programmers around the world. I asked for help and not for this lecture. and thank you for reading
|
|
|
|
|
nee-kow wrote: YES I'm on the distinction list
...By getting others to help/do the work for you?
I don't expect everyone to know everything about programming, after all this is what CP and similar sites are all about. But if you are struggling with binary trees and programming to include them then I suggest you ask more related questions. Then what ever useful information you gather then you pull it all together to get your program working.
Who is going to want to email you, get your source code, go through it and make it work for you, and all for free in their own time? Can I share your qualifications if I help you do it?
return 5;
|
|
|
|
|
Look my friend, you don't know me at all, how can you start judging me? I do not let other people do my work. After all I'm going to be an engineer... so I need to learn. Anyhow I don't have to explain myself. The point is, none of my classmates is capable of solving the project because we haven't been well exposed to the tree ADT. I suggested that someone takes the predefined classes, read them, so that he can have an idea on how to solve the project and give me some tips!!! because I don't know how to build a Huffman coding tree! and none of my classmates know. Now I'd be grateful if you can help me, and no I don't mean writing the code for me. However, if you do not wish to help me, and if you only want to mock me with your next reply, then please keep it to yourself.
|
|
|
|
|
Is it always this hard to get any useful information out of you? 3 decent sized paragraphs and so far all I have is binary tree and Huffman coding tree.
You say you have an assignment to do so perhaps a start may be to list the objectives of your assignment - which would have made a good basis to your original question.
Have these predefined classes been given to you as part of the assignment? surely these should be documented or have been explained as to what they do? If not, then I would think about complaining about whoever provided you with them.
return 5;
|
|
|
|
|
This was the whole point of telling you to message me on my e-mail, so I can send you the predefined classes and the assignment itself. the predefined classes are a part of the assignment. They were given by my doctor along with the assignment which is a word document. Everything is explained I just don't know where to post them, that's why I asked someone to text me on my e-mail. Anyways where can I attach them over here?
|
|
|
|
|
nee-kow wrote: Anyways where can I attach them over here?
You don't attach them. We are not here to do your homework for you! You have to ask questions related to what you are having problems with. What parts of your assignment have you done so far? or even attempted?
What you need to do is write a question in the following format...
- What you are trying to achieve (the objectives of the assignment)
- What you have to work with (explain what you predefined classes are used for)
- What you have tried so far (if anything)
- What you are having problems with (needs you to have actually tried something first)
And if you such a great student, why are you in such a hurry to get this done? surely you have not left this until the last minute?
return 5;
|
|
|
|
|
I'm in such a hurry because I've been studying from the beginning of my christmas break I have this project, a logic design project, another data structures homework, and three exams to study for. and After that, I have to start studying for my finals which begin on the 20th
Anyways, I changed my mind I don't need help. The last thing I want is people making fun of me. Thank you anyways.
|
|
|
|
|
Well to be honest I don't believe anything you have said. All I am hearing is that "I want your email address" - you can't even give a simple 'copy and paste' objective from your assignment, therefore I think your just trying to compile a spam list
What's that? I don't know you and how can I therefore say such things? - well maybe you should look at the evidence provided and apply some logic to that (perhaps one of your other homework assignments? )
I not set out to make fun of you, but if you really wanted any help then you would tell us what you are trying to do. Instead of just trying to get us to email you.
return 5;
|
|
|
|
|
<
This project revolves around an important text processing task, text compression. In particular, you will be required to encode a sequence of words read from a source file into binary strings (using only the characters 0 and 1). It is important to note that text compression makes it possible to minimize the time needed to transmit text over a low-bandwidth channel, such as infrared connection. Moreover, text compression is helpful in storing large documents more efficiently. The coding scheme explored in this project is the Huffman Coding Scheme. While standard encoding schemes, such as Unicode and ASCII, use fixed-length binary strings to encode characters, Huffman coding assigns variable-length codes to characters. The length of a Huffman code depends on the relative frequency of its associated character. Specifically, Huffman coding capitalizes on the fact that some characters are used more frequently than others to use short codewords when encoding high-frequency characters and long codewords to encode low-frequency characters. Huffman coding saves space over state of the art fixed-length encoding and is therefore at the heart of file compression techniques in common use today. Figure 1 shows the relative frequencies of the letters of the alphabet as they appear in a representative sample of English documents.
Letter Frequency Letter Frequency
A 77 N 67
B 17 O 67
C 32 P 20
D 42 Q 5
E 120 R 59
F 24 S 67
G 17 T 85
H 50 U 37
I 76 V 12
J 4 W 22
K 7 X 4
L 42 Y 22
M 24 Z 2
Figure 1. Relative frequencies for the 26 letters of the alphabet.
Huffman coding and decoding
Huffman’s algorithm for producing optimal variable-length codes is based on the construction of a binary tree T that represents the code. In other words, the Huffman code for each character is derived from a full binary tree known as the Huffman coding tree, or simply the Huffman tree. Each edge in the Huffman tree represents a bit in a codeword, with each edge connecting a node with its left child representing a "0" and each edge connecting a node with its right child representing a "1". Each external node in the tree is associated with a specific character, and the Huffman code for a character is defined by the sequence of bits in the path from the root to the leaf corresponding to that character. Given codes for the characters, it is a simple matter to use these codes to encode a text message. You will have simply to replace each letter in the string with its binary code (a lookup table can be used for this purpose).
In this project, you are not going to use the table given in Figure 1 to determine the frequency of occurrence per character. Instead, you will derive the frequency corresponding to a character by counting the number of times that character appears in an input file. For example, if the input file contains the following line of text "a fast runner need never be afraid of the dark", then the frequencies listed in the table given in Figure 2 should be used per character:
Character a b d e f H i k n O r s t u v
Frequency 9 5 1 3 7 3 1 1 1 4 1 5 1 2 1 1
Figure 2. The frequency of each character of the String X.
The code for a character is thus obtained by tracing the path from the root of the Huffman tree to the external node where that character is stored, and associating a left edge with 0 and a right edge with 1. In the context of the considered example for instance, the code for "a" is 010, and the code for "f" is 1100.
Once the Huffman tree is constructed and the message obtained from the input file has been encoded, decoding the message is done by looking at the bits in the coded string from left to right until all characters are decoded. This can be done by using the Huffman tree in a reverse process from that used to generate the codes. Decoding the bit string begins at the root of the tree. Branches are taken depending on the bit value – left for ‘0’ and right for ‘1’ – until reaching a leaf node. This leaf contains the first character in the message. The next bit in the code is then processed from the root again to start the next character. The process is repeated until all the remaining characters are decoded. For example, to decode the string "0101100" in the case of the example under study, you begin at the root of the tree and take a left branch for the first bit which is ‘0’. Since the next bit is a ‘1’, you take a right branch. Then, you take a left branch (for the third bit ‘1’), arriving at the leaf node corresponding to the letter a. Thus, the first letter of the coded word is a. You then begin again at the root of the tree to process the fourth bit, which is a ‘1’. Taking 2 right branches then two left branches, you reach the leaf node corresponding to the letter f.
Problem statement
You are required to implement the Huffman coding/decoding algorithms. After you complete the implementation of the coding/decoding processes, you are asked to use the resulting Java code to:
1. Read through a source file called "in1.dat" that contains the following paragraph:
"the Huffman coding algorithm views each of the d distinct characters of the string X as being in separate Huffman trees initially with each tree composed of a single leaf node these separate trees will eventually be joined into a single Huffman tree in each round the algorithm takes the two binary trees with the smallest frequencies and merges them into a single binary tree it repeats this process until only one tree is left."
2. Determine the actual frequencies for all the letters in the file.
3. Use the frequencies from the previous step to create a Huffman coding tree before you assign codes to individual letters. Use the LinkedBinaryTree class that we developed in class to realize your Huffman coding trees.
4. Produce an encoded version of the input file "in1.dat" and then store it in an output file called "out.dat".
5. Finally, the decoding algorithm will come into play to decipher the codes contained in "out.dat". The resulting decoded message should be written to an output file called "in2.dat". If nothing goes wrong, the text stored in "in1.dat" and the one in "in2.dat" must match up correctly.
Do I still look like I'm here to waste my time on spamming? I solved the first two steps of the statement. I just don't know how to build the tree.
|
|
|
|
|
Your assignment is interesting. I may have a go at it myself when I get some free time I will do without predefined classes though to make it interesting.
Here[^] is a simple logic explanation of how to create a Huffman tree. I imagine your pre-defined classes will come in here, but you will have to try to use them classes to achieve the logic.
I guess your classes hold a way to store the tree data and your task is to populate it? Hopefully you can get somewhere with the link and give it a try. Come back when your stuck on a bit of code. You could also try listing the classes (names only) that you have available to you in your predefined library
return 5;
|
|
|
|
|
You know what guys. I seriously take everything back. I don't want your help anymore Thank you for everything though.
|
|
|
|
|
nee-kow wrote: please reply to my e-mail
this is not how this site works. Besides, it may not be very smart to publish your e-mail address like that, any bot can grab it.
One normally researches the problem area using search engines, books, and the like. And then, when stuck, ask specific questions here, including some small code snippet if that would help, and then people will be glad to help you out.
BTW: if the entire class fails to understand the assignment, then I'd say something is wrong with the way the teacher operates. Talk to him.
|
|
|
|
|
Luc Pattyn wrote: if the entire class fails to understand the assignment, then I'd say something is wrong with the way the teacher operates
...too right! But hey, what can you expect from one of the top engineering schools in the country!
return 5;
|
|
|
|
|
Hi, i have successfully added validation for my textboxes. i have 2 buttons, the add and the delete. When the user click on the add button without any input to the textboxes, a message will display telling the user to input value, however when the delete button is clicked instead of the add button, the validation would appear and it wont allow me to delete. why is this so?
Needing help!
modified on Tuesday, January 4, 2011 10:27 PM
|
|
|
|
|
pancakeleh wrote: why is this so?
it is very difficult to predict why it is so. please mention you code
modified on Tuesday, January 4, 2011 11:16 PM
|
|
|
|
|
my delete button code as follows:
public String button1_action() {
try{
RowKey rk = tableRowGroup1.getRowKey();
if(rk != null){
incidentdataDataProvider.removeRow(rk);
incidentdataDataProvider.commitChanges();
incidentdataDataProvider.refresh();
}
}catch(Exception ex){
log("ErrorDescription", ex);
error(ex.getMessage());
}
return null;
}
my add button as follows:
public String add_btn_action(){
String myString = (String) getIncidentidtxt().getValue();
Integer incidentIDName = Integer.parseInt(myString);
String incidentNameName = (String)getncidentnametxt().getValue();
getSessionBean1().updateIncident(incidentIDName, incidentNameName);
incidentdataDataProvider.refresh();
return null;
}
|
|
|
|
|
before starting validation, check which button was pressed. should be somewhere available in a Event-object or you extract that information to some variable, which you can access when and where needed. a boolean value should do the trick.
regards
Torsten
I never finish anyth...
|
|
|
|
|
thanks i manage to solve it
|
|
|
|
|
please pancakeleh, how did u do it?show as the code please...thanks alot..
|
|
|
|
|
hi,
pls tell me.
which keyword used for differentiating local and global variable in java.
************ S G KORE *******************
|
|
|
|
|
There is no such thing as global variables in java.
|
|
|
|
|
All variables are defined by their scope, that is to say the block that contains them. Since no variable can exist outside a class there are no globals in Java. Take a look at the Java Tutorials[^] for more information.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|