Spring 2024 - CS301 - 2

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

Assignment No.

02
Total Marks: 20
SEMESTER Spring 2024
Lectures Covered:25-
CS301- Data Structures 26
Due Date: 24th June,
2024
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (marks) if:
 The assignment is submitted after due date.
 The submitted assignment file is not in .doc or .docx format.
 The submitted assignment file does not open or corrupted.
 The assignment is copied (from other student or ditto copy from handouts or internet).
Uploading instructions
 Do not wait for grace day. Grace Day is given only if there is problem with LMS on due date. Submit
your solution within due date.
 Note that no assignment will be accepted through email if there is any problem in LMS on grace day.

Objective
The objective of this assignment is

 To get hands on practice of constructing frequency table and Huffman encoding tree.

For any query about the assignment, contact at cs301@vu.edu.pk

Marks: 20
Question. No. 1:

Consider the following string saved into a string type variable. We want to send it over the network to
another computer. Use the given string and answer (solve) the questions given below.

String: “Data Structures is one of the core courses of BS(CS) program.”

Note: Double quotes are not the part of string.

a. Build frequency table and Huffman encoding tree. [14 Marks]


Use the following sample frequency table:

Character
Frequency
Number of
Bits used
without
any
encoding

Huffman
code of
each
character
Number of
Bits used
with
Huffman
encoding

b. Calculate how many bits will be used for the above string: [6 Marks]
 Without using any encoding technique
 With Huffman encoding technique
 What percentage of bits is saved by Huffman encoding scheme?

Wish you Best of Luck!

You might also like