|
![]() |
AyanBiswas
AyanBiswas
AyanBiswas
AyanBiswas
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
How do you know whether a Node is a leaf or not when you first create it?
AyanBiswas
AyanBiswas
AyanBiswas
Ayan Biswas wrote::I firstly converted the ascii codes in to their corresponding integer values and wrote them in a file
Ayan Biswas wrote:Now ,while decoding I read each byte from that file and converted it into its binary equivalent and searched for their ascii values in the map.This approach is creating the following problem.Since,01,001,1 all have integer equivalent as 1,so when I convert the codes into integer it no longer remains unique.
Ayan Biswas wrote:
:I firstly converted the ascii codes in to their corresponding integer values and wrote them in a file
Ayan Biswas wrote:
Now ,while decoding I read each byte from that file and converted it into its binary equivalent and searched for their ascii values in the map.This approach is creating the following problem.Since,01,001,1 all have integer equivalent as 1,so when I convert the codes into integer it no longer remains unique.
AyanBiswas
AyanBiswas
Ayan Biswas wrote:@Henry thanks for the idea.But using the codes in string format wont be much helpful.because firstly the encoded file will be much larger in size and while decoding (say10011) how will I know to search for '1' or 10 or 100 ..But I will try to use the ascii codes and their leading 0's in another Map and give it a try.
![]()
AyanBiswas
Ayan Biswas wrote:
But the problem is ,suppose i have d=011,whose integer value is 3 ,same as b's.So,codes are no longer unique.this is the problem that i am facing.![]()
AyanBiswas
You can try parsing the "101" String with 2 as the radix to get 5, but you are probably better off getting the codes into numbers initially.
By the way: if I remember correctly, each character in a String is stored as a char, so a String like "101" would require 6 bytes, not 3 (plus pointers to the Class<String> object, etc etc).
AyanBiswas
Campbell Ritchie wrote:Bear has earlier showed you how to compress your file by putting different combinations of bits together. If you are using Strings, then 10101 is at least 10 bytes, if you get it into a number, then 10101 is 5 bits.
AyanBiswas
AyanBiswas
AyanBiswas
Clowns were never meant to be THAT big! We must destroy it with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
|