{
unsigned char **dict;
int *dlength;
unsigned char p[80], temp[80];
char c;
int plength,i,j,k,diff,cd;
plength=1;
cd=256;
p[0]=EOF;
dict= (unsigned char *)malloc(99999); //Allocating memory for Dictionary
if(dict == NULL)
printf("Unable to allocate memory \n");
dlength=(int *)malloc(99999);
for (i = 0; i < 99999; i++) {
dict[i]=(unsigned char *)malloc(60);
if(dict[i]==NULL)
printf("Unable to allocate memory \n");
}
for (i=0;i<256;i++) //loading dictionary with ASCII set
{
dict[i][0]=i;
dlength[i]=1;
}
while ((c = fgetc(Fpt)) != EOF)
{
if(cd==256)
p[0]=(unsigned char *)c;
diff=0;
for (i=0; i<cd; i++)
{
for (k=0; k<plength; k++) //checking to see if p+c in dict
{
if(dict[i][k]!=p[k])
diff=1;
}
}
if (diff==0)
{
p[plength]=(unsigned char)c;
plength++;
}
if (diff==1)
{
for (i=0; i<cd; i++)
{
for (k=0; k<plength; k++)
{
if(dict[i][k]!=p[k])
diff=1;
}
if (diff==0)
j=i;
}
fputc(j, outfile);
for (i=0; i<plength; i++)
{
dict[cd][i]= p[i];
}
dict[cd][plength]=(unsigned char)c;
cd++;
p[0]=c;
}
}
for (i=0; i<cd; i++)
{
for (k=0; k<plength; k++)
{
if(dict[i][k]!=p[k])
diff=1;
}
if (diff==0)
j=i;
}
fputc(j, outfile);
fclose(outfile);
fclose(Fpt);
}
By Amit Setia
JavaScript is one program that has been written in C to implement the Apriori algorithm. There are also several other known programs available on the Internet that implement it as well.
Ronaldo! 'c' coding of Ricart-agarwala algorithm
yes we can do it,in c
no.
Compression/decompression is all about raw speed and efficiency. Java is neither fast nor efficient. However, converting from C++ to Java isn't terribly difficult and Huffman's algorithm and its variations are well documented. Just don't expect to create anything that's remotely useful to you in Java.
The source code, in C, will depend on what type of lossless compression algorithm will be used. A source code should be available from various computer scientists in your area.
A C++ implementation of the Binary GCD (Stern's) algorithm is shown in the Related Link below.
Lempel-Ziv-Welch (LZW) encoding is patented, thus we cannot show you a working example. However, the basic algorithm is well-documented on various websites including Wikipedia. If you can follow the algorithm, you can write the code. But you cannot distribute the code without the requisite licence.
JavaScript is one program that has been written in C to implement the Apriori algorithm. There are also several other known programs available on the Internet that implement it as well.
Ronaldo! 'c' coding of Ricart-agarwala algorithm
You don't write an algorithm for a C++ program, unless you are documenting the C++ program after-the-fact. The normal procedure is to write the algorithm first, in a language independent fashion, and then translate that stated algorithm into C++ code, or into whatever language you wish.
Algorithm is a step by step process to solve a particular task.
The algorithm is A/B * C/D = AB/CD.
yes we can do it,in c
no.
reymond rillera reymond rillera
Compression/decompression is all about raw speed and efficiency. Java is neither fast nor efficient. However, converting from C++ to Java isn't terribly difficult and Huffman's algorithm and its variations are well documented. Just don't expect to create anything that's remotely useful to you in Java.