#include stdafx.h
#include iostream
using namespace std;
const int len = 20;
const int maxCount = 127;
int rle(char* pStr, int length, char* pNew) {
if (!pStr) return -1;
if (length 3) return -1;
int i = 0;
int k = 0;
char p1 = pStr[i++];
char p2 = pStr[i++];
char p3 = pStr[i++];
int pos=0;
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Fri, Jun 8, 2012 at 12:54 PM, Ashish Goel ashg...@gmail.com wrote:
#include stdafx.h
#include iostream
using namespace std;
const int len = 20;
const int maxCount = 127;
int rle(char* pStr,
The idea here is that there will be parts of the stream which actually
should not be compressed. For example abcdef as well as aa do not need any
compression. We need to compress only if 3 characters match because for
compressing two chars we will take up 2 chars so no compression benefit (:
So
Will fail for the sing having say 257characters all same
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Sat, May 26, 2012 at 12:26 PM, Navin Gupta navin.nit...@gmail.comwrote:
This is called Run-Length-Encoding (RLE) of a string.
Its purpose
u forgot to do inplace and you have wrong conversion of count
On Sat, May 26, 2012 at 11:31 AM, Anchal Gupta anchal92gu...@gmail.comwrote:
hey, here is the function that do the compression and store the output
in an array op.
void str_comp(char *str)
{
int count=0,j=0,i;
char
yeah i forgot inplace so to do that we simply add count and ch in str
input array instead of op.
btw whats wrong with count it give me right answer.
On May 26, 12:08 pm, Hassan Monfared hmonfa...@gmail.com wrote:
u forgot to do inplace and you have wrong conversion of count
On Sat, May 26,
1- try abb
On Sat, May 26, 2012 at 12:07 PM, Anchal Gupta anchal92gu...@gmail.comwrote:
yeah i forgot inplace so to do that we simply add count and ch in str
input array instead of op.
btw whats wrong with count it give me right answer.
On May 26, 12:08 pm,
http://michael.dipperstein.com/rle/index.html
and basic one is
http://www.fileformat.info/mirror/egff/ch09_03.htm
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Sat, May 26, 2012 at 1:10 PM, Hassan Monfared hmonfa...@gmail.comwrote:
1- try
This is called Run-Length-Encoding (RLE) of a string.
Its purpose is to save space.So in case of abcdef,I think the output needed
is abcdef (1 is implicit).
The added benefit is it makes the solution in-place.
Approach:- (In-place and Linear Time)
Start from the left of string and