Professional Documents
Culture Documents
DAA Paper SFinal For BCS B17
DAA Paper SFinal For BCS B17
NOTE: Answer the questions on white pages of A4 size. Only handwritten solution will be acceptable.
Every page must contain Name, Registration, Section and page number. Upload the solution in one
PDF file within the given time on CUOnline. Keep your cameras on during the exam.
Q – 1: In Philippines, coins of 1, 5, 10, 25 centavos (officially called sentimo), 1₱, 5₱ and 10₱
(officially called Peso) and currency notes of 20₱, 50₱, 100₱, 500₱, 1000₱ are used. How can
we make the following denominations using Coin Change Problem with greedy approach? Also
write an algorithm for coin change problem using dynamic programming with its complexity
analysis. [15]
i) 7.34 ₱
ii) 2891.45 ₱
iii) 390.21 ₱
iv) 74.58 ₱
v) 0.99 ₱
i) What will be the order of the nodes being traversed using Depth First Search?
ii) What will be the order of the nodes being traversed using Breadth First Search?
iii) If we implement the bag using a stack, show how will we push the nodes into the
stack using DFS?
iv) If we implement the bag using a stack, show how will we push the nodes into the
stack using BFS?
Q – 3: Write down the algorithm for Huffman Encoding Technique with its complexity analysis.
Consider your name and registration number as a string, apply Huffman Encoding Technique on
this string. (e.g. MUHAMMAD-ALI-MUSA-FA14-BCS-101) [15]