CS301 Assignment 3 Solution
#1
CS301 Data Structures Assignment 3 Complete Solution

Objective
The objective of this assignment is,
o  To make you familiar with concept of Huffman Encoding.

Question 1:
While transmission through network, it is always important to keep data transmission rate high so data over the network can be increased using two ways; either increases the bandwidth of communication channel or decrease the size of data (compression) to increase the bandwidth utilization.
Lossless data compression algorithms are important in network and Huffman encoding scheme can be used for lossless data compression. Suppose the following string is being transmitted over the network:
 
Data Compression in data structure
 
We cannot increase the bandwidth of communication channel. Instead we have to compress the given string. Use Huffman encoding scheme to encode the given string.
 
Solution
To encode the string:

  1. Build a table containing the following information about the string.
[Image: QaX1BNg.jpg]
2. Build Huffman encoding tree. The tree will be built with the help of characters and their respective frequencies which you will find in step 1. 
Huffman Tree[Image: t1EV79x.png]

If you did not understood any step or have any questions regarding Huffman Encoding or the assignment, post below in the comments. 

Good luck!
#2
How to solve Part 3?
3. Calculate how much bits are consumed by original and compressed string. What percentage of bits is saved by Huffman encoding scheme?
#3
(01-20-2017, 11:44 AM)Lahori Wrote: How to solve Part 3?
3. Calculate how much bits are consumed by original and compressed string. What percentage of bits is saved by Huffman encoding scheme?

For part 3, calculate number of bits of the string in ASCII code and then calculate number of bits of the string using Huffman Encoding, and then you'll have to tell what percentage you save by using Huffman encoding.
#4
please explain 3rd part clearly i m so much confuse in this ASCII and huffman
#5
(01-20-2017, 12:26 PM)hafsarana Wrote: please explain 3rd part clearly i m so much confuse in this ASCII and huffman

In ASCII code we need 8 bits to represent every character. So for example if there are 50 characters, total number of bits required to send this string will be 50x8 = 400
Now in Huffman code, you will get different number of bits for different characters, the characters with the most frequency will need the least amount of bits as they will have the shortest Huffman code associated with them. 
In this assignment you will need to calculate the sum of all those bits, lets suppose the sum of all Huffman code bits is equal to 100. 
To calculate percentage, 100/400 * 100 = 40% which means you are saving 60% of the data by using Huffman encoding. 

Hope this cleared it for you.
#6
(01-20-2017, 03:55 PM)Rana Wrote:
(01-20-2017, 12:26 PM)hafsarana Wrote: please explain 3rd part clearly i m so much confuse in this ASCII and huffman

In ASCII code we need 8 bits to represent every character. So for example if there are 50 characters, total number of bits required to send this string will be 50x8 = 400
Now in Huffman code, you will get different number of bits for different characters, the characters with the most frequency will need the least amount of bits as they will have the shortest Huffman code associated with them. 
In this assignment you will need to calculate the sum of all those bits, lets suppose the sum of all Huffman code bits is equal to 100. 
To calculate percentage, 100/400 * 100 = 40% which means you are saving 60% of the data by using Huffman encoding. 

Hope this cleared it for you.
bro, clearly give us the solution of 3rd point as today is last date

bro, clearly give us the solution of 3rd point as today is last date
#7
(01-20-2017, 05:55 PM)wasim_288 Wrote:
(01-20-2017, 03:55 PM)Rana Wrote:
(01-20-2017, 12:26 PM)hafsarana Wrote: please explain 3rd part clearly i m so much confuse in this ASCII and huffman

In ASCII code we need 8 bits to represent every character. So for example if there are 50 characters, total number of bits required to send this string will be 50x8 = 400
Now in Huffman code, you will get different number of bits for different characters, the characters with the most frequency will need the least amount of bits as they will have the shortest Huffman code associated with them. 
In this assignment you will need to calculate the sum of all those bits, lets suppose the sum of all Huffman code bits is equal to 100. 
To calculate percentage, 100/400 * 100 = 40% which means you are saving 60% of the data by using Huffman encoding. 

Hope this cleared it for you.
bro, clearly give us the solution of 3rd point as today is last date


From above diagram, the number of bits used by Huffman code is = 55, now to calculate percentage, divide 55 by original number of bits with ASCII code i.e = 272, it results as 0.2022, multiplying with 100 gives 20.22%
#8
i need complete  file solution of cs301 as soon as posible
#9
(01-20-2017, 07:49 PM)sidra husnain Wrote: i need complete  file solution of cs301 as soon as posible

Complete solution is posted here. No point in submitting someone else's file, you just have to make your file from the solution posted here. Do it yourself so you get the maximum marks. 
If you do not understand anything, then feel free to ask.
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Assignment Solutions Iram shahzad 2 140 05-22-2017, 08:21 AM
Last Post: Rana
  CS301 Assignment 2 Solution - Spring 2017 Rana 0 350 05-17-2017, 08:54 PM
Last Post: Rana
  cs504 assignment 1 help needed Syed Muhammad Taha 3 225 05-10-2017, 04:44 PM
Last Post: Rana
  CS403 Assignment 1 help required Syed Muhammad Taha 3 226 05-06-2017, 06:50 PM
Last Post: Rana
  CS506 Assignment No1 Solved 2017 Rubaisha(Moody Girl) 0 313 05-05-2017, 02:11 PM
Last Post: Rubaisha(Moody Girl)
Thumbs Up cs402 Assignment jamshed Ansari 1 202 05-03-2017, 06:05 PM
Last Post: Rana
  CS610 Assignment 1 Pakistani 3 490 05-03-2017, 01:50 PM
Last Post: jamshed Ansari
  CS601 Data Communication Assignment Solution Rana 2 1,343 02-07-2017, 06:00 PM
Last Post: Pakistani
  CS601 Assignment 3 Solution Rana 0 589 01-12-2017, 01:41 PM
Last Post: Rana
  CS301 Current Mid-Term Exam Rana 0 417 12-17-2016, 10:13 AM
Last Post: Rana



Users browsing this thread:
1 Guest(s)