3rd Sem Project Report
3rd Sem Project Report
A PROJECT REPORT
Submitted By
JIGAR CHHEDA & MANJINDER SINGH BHATIA
2010-2011
Page | 1
Acknowledgement
Few pleasant feelings are beyond words which
could be felt only by heart. Here we are trying to bead
our feelings into few pearls of words, but honestly this
means a lot for us than these simple words. Here we are
trying to express our thankful feelings to those people
who supported us directly or indirectly for
accomplishing this project. We are deeply indebted to
all those were associated with the successful completion
of “ S.Y.MCA(Sci) Project”.
We are also thankful to Mr. S.M. Mali HOD of our IT
department. Special thanks to our project guide Ms.
Ujawala our subject teacher.
Prepared By:
Jigar Chheda
Manjinder Singh Bhatia
Page | 2
PLATFORM USED
Turbo C++: Turbo C++ was a C++ compiler and integrated
development environment (IDE) originally from Borland. Most
recently it was distributed by Embarcadero Technologies, which
acquired all of Borland's compiler tools with the purchase of its
CodeGear division in 2008. The original Turbo C++ product line
was put on hold after 1994, and was revived in 2006 as an
introductory-level IDE, essentially a stripped-down version of their
flagship C++Builder. Turbo C++ 2006 was released on September
5, 2006 and was available in 'Explorer' and 'Professional' editions.
The Explorer edition was free to download and distribute while the
Professional edition was a commercial product. In October 2009
Embarcadero Technologies discontinued support of its 2006 C++
editions. As such, the Explorer edition is no longer available for
download and the Professional edition is no longer available for
purchase from Embarcadero Technologies. Turbo C++ is
succeeded by C++Builder.
Page | 3
C++ (programming language): C++ is a statically typed,
free-form, multi-paradigm, compiled, general-purpose
programming language. It is regarded as a "middle-level" language,
as it comprises a combination of both high-level and low-level
language features. It was developed by Bjarne Stroustrup starting
in 1979 at Bell Labs as an enhancement to the C language and
originally named C with Classes. It was renamed C++ in 1983.
Page | 4
INTRODUCTION
“ To design the system that will allow the user to enter the total
number of characters with their frequencies at the terminal and
then display the Huffman codes on the terminal in an interactive
manner.”
Page | 5
Objective Of The Project
In computer science and information theory, Huffman coding is an
entropy encoding algorithm used for lossless data compression.
The term refers to the use of a variable-length code table for
encoding a source symbol (such as a character in a file) where the
variable-length code table has been derived in a particular way
based on the estimated probability of occurrence for each possible
value of the source symbol.
Huffman coding uses a specific method for choosing the
representation for each symbol, resulting in a prefix code
(sometimes called "prefix-free codes", that is, the bit string
representing some particular symbol is never a prefix of the bit
string representing any other symbol) that expresses the most
common source symbols using shorter strings of bits than are
used for less common source symbols. Huffman was able to design
the most efficient compression method of this type: no other
mapping of individual source symbols to unique strings of bits will
produce a smaller average output size when the actual symbol
frequencies agree with those used to create the code. A method
was later found to design a Huffman code in linear time if input
probabilities (also known as weights) are sorted.
Page | 6
Hardware Requirements
Software Requirements
Page | 7
PROPOSED SYSTEM : If the user enters only one symbol this
leads to incompleteness which is removed by not using of
algorithm and we can conventionally assign 1 or 0 to the symbol.
Similarly, the number of symbols cant be greater than 94
Page | 8
DATA FLOW DIAGRAM
A Data Flow Diagram can be used to describe the existing or
planned data processing of an organization. It is Pictorial
Technique to indicate:
The flow of data between the above three components of DFD’s are
better compared to text because of unambiguous description,
preciseness and three enforce related description, preciseness and
three enforce related description to appear.
Page | 9
DFD
Page | 10
Project Flow
Given Data:
Encoding:
Steps:
1)
2)
3)
Page | 11
4)
5)
6)
Page | 12
Final Output
Page | 13
Coding:
#include<iostream.h>
#include<fstream.h>
#include<string.h>
#include<conio.h>
#include<stdlib.h>
int freq;
char ch[MAX];
}NODE;
NODE* temp;
Page | 14
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
NODE* ptr;
ptr->ch[0]='\0';
ptr->freq = x;
strcpy(ptr->ch , a);
return(ptr);
int i=0;
Page | 15
a[i] = a[i+1];
int i=0;
cout<<c[i];
cout<<"\n";
else
c[n] = 1;
n++;
Assign_Code(tree->left, c, n);
c[n-1] = 0;
Assign_Code(tree->right, c, n);
Page | 16
}
if(root!=NULL)
Delete_Tree(root->left);
Delete_Tree(root->right);
free(root);
void main()
int freq,intt;
clrscr();
str[0]='\0';
Page | 17
data[0]='\0';
data1[0]='\0';
data2[0]='\0';
str1[0]='\0';
name='\0';
fname[0]=NULL;
a[0]='\0';
for(i=0;i<255;i++) count[i]=0;
cin>>fchoice;
if(fchoice==1)
cin>>fname;
ofstream fout(fname);
while(cin)
cin.get(name);
fout<<name;
Page | 18
}
fout.close();
if(fchoice==2)
cin>>fname;
cout<<"\n";
ifstream fin(fname);
while(fin)
fin.get(name);
cout<<name;
str[ln]=name;
ln++;
cout<<"\n";
getch();
for(i=0;i<ln-2;i++)
data[i]=str[i];
intt=(int)data[i];
Page | 19
count[intt]=count[intt]+1;
d=0;
tcount=2;
for(i=0;i<255;i++)
data1[i]='\0';
if(count[i]>=1)
data1[i]=(char)i;
data2[0]=data1[i];
freq=count[i];
a[d]=create(data2,freq);
data2[0]='\0';
tcount++;
d++;
sort(a,tcount);
u = a[0]->freq + a[1]->freq;
strcpy(str,a[0]->ch);
strcat(str,a[1]->ch);
Page | 20
ptr = create(str, u);
ptr->right = a[1];
ptr->left = a[0];
a[0] = ptr;
sright(a,tcount);
tcount--;
Assign_Code(a[0], c, 0);
Delete_Tree(a[0]);
getch();
Page | 21
CONCLUSION
Page | 22
BIBLIOGRAPHY
1) http://www.google.co.in/
2) Indroduction To Algorithm – PHI Publication
3) http://en.wikipedia.org/wiki/Huffman_coding
4) Complete Reference C++
Page | 23