Hi All,
My data set consist of numeric values 0s and 1s. I have designed a code that enables me to compress the string (rwo) to substring based on LZ algorthim. However, it seems that the substring is not correct as you can see in the following example:
reading file -------------------> writing file
Example 1. 100010000000000100--------->{1,0,001,0000,0000001,00}
Example 2. 001001110010010000--------->{0,01,0011,10010,01000,0}
The correct answer should be like this see this but unfortunately i could not design it correctelly.
S = 010110011 ------------------------>substrings {0, 1, 01, 10, 011},
S= 001001------------------------------->substring {0,01,001}
Thank you very much in advance.
Please see the attched code
Loading

Sam HobbsRank #107 · 20.5K reputationPosted Apr 17, 2011, 5:22 PM EDT
Nony K29 reputationPosted Apr 17, 2011, 5:33 PM EDT
Nony K29 reputationPosted Apr 17, 2011, 5:33 PM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Apr 17, 2011, 7:04 PM EDT
Nony K29 reputationPosted Apr 17, 2011, 9:56 PM EDT
The only problem that i have is on the outcome. The result of my algorthim is not correct 100010000000000100--------->{1,0,001,0000,0000001,00}
001001110010010000--------->{0,01,0011,10010,01000,0} . I need your advice on how can i change my code to get the correct LZ algorthim examples.
the correct LZ examples
S = 010110011 ------------------------>substrings {0, 1, 01, 10, 011},
S= 001001------------------------------->substring {0,01,001}
Suthish NairRank #92 · 22.8K reputationPosted Apr 18, 2011, 10:50 AM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Apr 18, 2011, 11:07 AM EDT
Nony K29 reputationPosted Apr 19, 2011, 1:52 AM EDT
Thank you for your assistant.
Nony K29 reputationPosted Apr 19, 2011, 1:53 AM EDT
Thank you for your assistant.
VulpesRank #55 · 29.2K reputationPosted Apr 19, 2011, 2:25 AM EDT
However, I'd check your implementation against this one (http://www.codeproject.com/KB/recipes/VB_LZW.aspx) which seems to work OK. It's in VB.Net rather than C# but shouldn't be difficult to translate.
Sam HobbsRank #107 · 20.5K reputationPosted Apr 19, 2011, 11:32 AM EDT
Also as you, Vulpes, say we don't see the source code. I think Nony is not putting much effort into this.
Vulpes, there are a few articles in this web site showing use of DeflateStream, which uses the LZ algorithm.
VulpesRank #55 · 29.2K reputationPosted Apr 19, 2011, 12:06 PM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Apr 19, 2011, 12:25 PM EDT
Nony K29 reputationPosted Apr 19, 2011, 3:15 PM EDT
I have attached the source code which i thought i did before but i did not aware that my code had not been upload. Please find the code attached.
Nony K29 reputationPosted Apr 19, 2011, 3:17 PM EDT
I have attached the source code which i thought i did before but i did not aware that my code had not been upload. Please find the code attached.
Sam HobbsRank #107 · 20.5K reputationPosted Apr 19, 2011, 5:01 PM EDT