3rd Sem Project Report
-
Upload
jigar-chheda -
Category
Documents
-
view
223 -
download
0
Transcript of 3rd Sem Project Report
-
8/8/2019 3rd Sem Project Report
1/23
Page | 1
HUFFMANN CODING
In partial fulfillment for the award of the degree
of
MASTERS OF COMPUTER APPLICATIONS
S.Y.MCA (III SEM)
MAEERS ARTS, COMMERCE AND SCIENCE COLLEGE, PUNE-38
2010-2011
-
8/8/2019 3rd Sem Project Report
2/23
Page | 2
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 ChhedaManjinder Singh Bhatia
-
8/8/2019 3rd Sem Project Report
3/23
Page | 3
PLATFORM USED
Turbo C++: Turbo C++ was a C++ compiler and integrateddevelopment environment (IDE) originally from Borland. Mostrecently it was distributed by Embarcadero Technologies, which
acquired all of Borland's compiler tools with the purchase of itsCodeGear division in 2008. The original Turbo C++ product line
was put on hold after 1994, and was revived in 2006 as anintroductory-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 theProfessional edition was a commercial product. In October 2009Embarcadero Technologies discontinued support of its 2006 C++
editions. As such, the Explorer edition is no longer available fordownload and the Professional edition is no longer available for
purchase from Embarcadero Technologies. Turbo C++ is
succeeded by C++Builder.
-
8/8/2019 3rd Sem Project Report
4/23
Page | 4
C++ (programming language): C++ is a staticallytyped, 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-levellanguage 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.
As one of the most popular programming languages ever created,
C++ is widely used in the software industry. Some of its
application domains include systems software, application
software, device drivers, embedded software, high-performance
server and client applications, and entertainment software such asvideo games. Several groups provide both free and proprietary C++
compiler software, including the GNU Project, Microsoft, Intel and
Borland. C++ has greatly influenced many other popular
programming languages, most notably C# and Java.
C++ is also used for hardware design, where design is initially
described in C++, then analyzed, architecturally constrained, and
scheduled to create a register transfer level hardware description
language via high-level synthesis.
The language began as enhancements to C, first adding classes,
then virtual functions, operator overloading, multiple inheritance,
templates, and exception handling among other features. After
years of development, the C++ programming language standard
was ratified in 1998 as ISO/IEC 14882:1998. That standard is still
current, but is amended by the 2003 technical corrigendum,
ISO/IEC 14882:2003. The next standard version (known
informally as C++0x) is in development.
-
8/8/2019 3rd Sem Project Report
5/23
Page | 5
INTRODUCTION To design the system that will allow the user to enter the total
number of characters with their frequencies at the terminal andthen display the Huffman codes on the terminal in an interactivemanner.
The main aim of the feasibility study activity is to determinewhether it would be financially, and technically feasible to develop
the product. After thoroughly analyzing the problem definition and
Huffman coding algorithm from various standard books oninformation theory and internet various strategies for solving theproblem were analyzed and finally the algorithm based on priority
queue (singly linked list) was chosen.
-
8/8/2019 3rd Sem Project Report
6/23
Page | 6
Objective Of The Project
In computer science and information theory, Huffman coding is anentropy encoding algorithm used for lossless data compression.
The term refers to the use of a variable-length code table forencoding a source symbol (such as a character in a file) where the
variable-length code table has been derived in a particular waybased on the estimated probability of occurrence for each possiblevalue of the source symbol.
Huffman coding uses a specific method for choosing therepresentation for each symbol, resulting in a prefix code
(sometimes called "prefix-free codes", that is, the bit stringrepresenting some particular symbol is never a prefix of the bit
string representing any other symbol) that expresses the mostcommon source symbols using shorter strings of bits than are
used for less common source symbols. Huffman was able to designthe most efficient compression method of this type: no other
mapping of individual source symbols to unique strings of bits willproduce a smaller average output size when the actual symbol
frequencies agree with those used to create the code. A methodwas later found to design a Huffman code in linear time if input
probabilities (also known as weights) are sorted.
-
8/8/2019 3rd Sem Project Report
7/23
Page | 7
Hardware Requirements
Memory : 16 M.B or better.
Processor: Pentium-IV or above.
Disk Space required: 25 M.B.Keyboard: Standard keyboard.
Mouse: Standard mouse.Moniter: Svga monitor.
Software Requirements
Operating System: Windows 98, 2000 or above.
Platform: Turbo C++ or Borland C++, Visual C++
Development Language: C++.
-
8/8/2019 3rd Sem Project Report
8/23
Page| 8
PROPOSED SYSTEM : If th user enters onl one symbol thisleads to in
ompleteness whi
h is removed by not usin
of
al
orithm and we can conventionall y assi
n1or 0 to the symbol
Similarly, the number of symbols cant be greater than94
Our proposed system has severalADVANTAGE
User friendly interface Less error More Storage Capacity
-
8/8/2019 3rd Sem Project Report
9/23
Page | 9
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:
1) The entities, which are source of destination of data or outputprocessing etc.
2)The Process where data is transferred.3)The flow storage where data is transferred.
The flow of data between the above three components of DFDs are
better compared to text because of unambiguous description,
preciseness and three enforce related description, preciseness and
three enforce related description to appear.
An ideal DFD technique should facilitate top down successive
requirement approach to present details so that neither the
analyst nor the users (who must understand and approve the
proposals) are swamped by details.
Be independent of physical implementation technique i.e. a DFDshould indicate only the logical requirement of the system without
making assumptions about or implying how data process will be
implemented:
1)Esily understood by all.2)Easily facilitates expressing refrence tradeoff i.e. the user
analyst be in position to discuss evaluate alternatives at thelevels of DFD itself. The DFD methodology is quite effective. It
does not depend on hardware, software data structure or file
organization.
-
8/8/2019 3rd Sem Project Report
10/23
Page|10
DFD
-
8/8/2019 3rd Sem Project Report
11/23
Page|11
Proje FlowGiven Data:
Encoding:
Steps:
1)
2)
3)
-
8/8/2019 3rd Sem Project Report
12/23
Page|12
4)
5)
6)
-
8/8/2019 3rd Sem Project Report
13/23
Page|13
Final Output
-
8/8/2019 3rd Sem Project Report
14/23
Page | 14
Coding:
#include
#include
#include
#include
#include
#define MAX 100
typedef struct node
{
struct node* left;
int freq;
char ch[MAX];
struct node* right;
}NODE;
void sort(NODE* a[], int n)
{
int i=0, j=0;
NODE* temp;
for(i = 0; i < n - 1; i++)
{
for(j = i; j < n; j++)
{
if(a[i]->freq > a[j]->freq)
-
8/8/2019 3rd Sem Project Report
15/23
Page | 15
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
}
NODE* create(char a[], int x)
{
NODE* ptr;
ptr = (NODE *)malloc(sizeof(NODE));
ptr->ch[0]='\0';
ptr->freq = x;
strcpy(ptr->ch , a);
ptr->right = ptr->left = NULL;
return(ptr);
}
void sright(NODE* a[], int n)
{
int i=0;
for(i=1; i
-
8/8/2019 3rd Sem Project Report
16/23
Page | 16
a[i] = a[i+1];
}
}
void Assign_Code(NODE* tree, int c[], int n)
{
int i=0;
if((tree->left == NULL) && (tree->right == NULL))
{
cout
-
8/8/2019 3rd Sem Project Report
17/23
Page | 17
}
}
void Delete_Tree(NODE * root)
{
if(root!=NULL)
{
Delete_Tree(root->left);
Delete_Tree(root->right);
free(root);
}
}
void main()
{
NODE* ptr, * head;
int i, fchoice=0, u=0, c[15], count[255], tcount=0,d=0;
char str[MAX], name, fname[50], data[MAX], data1[MAX],
data2[MAX], str1[MAX];
static NODE *a[100];
int freq,intt;
static int ln=0;
clrscr();
str[0]='\0';
data[0]='\0';
-
8/8/2019 3rd Sem Project Report
18/23
Page | 18
data1[0]='\0';
data2[0]='\0';
str1[0]='\0';
name='\0';
fname[0]=NULL;
a[0]='\0';
for(i=0;i
-
8/8/2019 3rd Sem Project Report
19/23
Page | 19
}
if(fchoice==2)
{
coutfname;
cout
-
8/8/2019 3rd Sem Project Report
20/23
Page | 20
d=0;
tcount=2;
for(i=0;i=1)
{
data1[i]=(char)i;
data2[0]=data1[i];
freq=count[i];
a[d]=create(data2,freq);
data2[0]='\0';
tcount++;
d++;
}
}
while (tcount > 1)
{
sort(a,tcount);
u = a[0]->freq + a[1]->freq;
strcpy(str,a[0]->ch);
strcat(str,a[1]->ch);
ptr = create(str, u);
ptr->right = a[1];
-
8/8/2019 3rd Sem Project Report
21/23
Page | 21
ptr->left = a[0];
a[0] = ptr;
sright(a,tcount);
tcount--;
}
Assign_Code(a[0], c, 0);
Delete_Tree(a[0]);
getch();
}
-
8/8/2019 3rd Sem Project Report
22/23
Page | 22
CONCLUSION
Our project is only a humble venture to satisfy
the needs in an Institution. Several user friendly coding
have also adopted.
Last but not least it is no the work that played the
ways to success but ALMIGHTY
-
8/8/2019 3rd Sem Project Report
23/23
BIBLIOGRAPHY
1)http://www.google.co.in/2)Indroduction To Algorithm PHI Publication3)http://en.wikipedia.org/wiki/Huffman_coding4)Complete Reference C++