Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

North South University

FINAL ASSIGNMENT
Department of Electrical & Computer Engineering

CSE 225 / SEC-3 DR ZIAUL HOSSAIN (ZHO)


TOTAL MARKS – 20

FINAL SUBMISSION DEADLINE: 04 Oct 2020


INSTRUCTIONS:
1. SUBMIT YOUR ASSIGNMENT ONCE ONLY THROUGH GOOGLE

CLASSROOM; NO EMAIL SUBMISSION

2. YOU CAN MAKE A GROUP OF MAX. 2 PERSONS FOR THIS FINAL


ASSIGNEMENT (OR CAN SUBMIT IN SINGLE TOO)
3. YOU ARE EXPECTED TO COMPLETE THE TASK BY YOUR GROUP ONLY;
PLAGIARISM IS STRICTLY PROHIBITED; IF CONVINCED, SIMILAR
COPIES MAY BE MARKED ‘0’
4. FAILURE TO SUBMIT WITHIN DEADLINE WILL BE MARKED ‘0’
5. ANSWERS MUST BE HANDWRITTEN IN PAPER, AND THEN
SUBMITTED IN A SCANNED PDF FILE
6. ANSWER ALL THE QUESTIONS; ANSWER THEM IN ORDER I.E.
SEQUENTIALLY- QUESTION 1,2,3 …
7. SUBMISSIONS MUST BE NEAT AND CLEAN
8. YOU MAY USE CODING YOURSELF TO VERIFY YOUR ANSWER IF
RELEVANT
QUESTIONS:
1. LINKED LIST: (8)
Implement the 2D circular linked list as explained in the PowerPoint
slides. You should write the algorithms for the functions mentioned
in the slides. The algorithms should be clear enough to understand
the logic. You may add code in C++ as well (this is optional but
preferred).

2. Binary Search Tree (BST) (5)


The In-Order traversal and Post-Order traversal for a BST is given
below. Construct the BST and explain in short the logic/algorithm
behind making the tree from these two traversal sequences:
In-Order: ABCDFGKLMOPR
Post-Order: ACBFDLKORPMG

3. Graph (7)
Coin Change Problem: Suppose you have only 20, 10 and 5 taka
notes. Now you want give someone 45 taka. You can pay him in
several ways:
20, 20, 5 = 45
20, 10, 10, 5 = 45
10, 10, 10, 10, 5 = 45
20, 10, 5, 5, 5 = 45
…..
5, 5, 5, 5, 5, 5, 5, 5, 5 = 45
we want to find the minimum number of notes needed for this, in
this example it is 3 notes (20 + 20 + 5 these three notes make 45).

We can use the BFS algorithm to find this minimum no of notes.


Modify the BFS algorithm so that it gives you the minimum no of
notes to make a sum.

WRITING YOUR OWN ALGORITHM/CODE IS PREFERRED. YOU


MAY RESEARCH THE WEB FOR THE SOLUTION BUT SHOULD
EXPLAIN WHAT IS HAPPENING IN THAT CASE.
Your task is to write a function minNotes which takes
the sum value to make (X) and an array containing note
values (arr[]); the function will return the minimum
notes required;
int minNotes ( X, arr[])
// this function will implement the BFS logic

Here’s a explanation how this will work: the BFS algorithm starts
with root value 45, and it will have three adjacent vertices 25, 35
and 40. These nodes are found by subtracting the note values 20,
10 and 5 respectively. In the next step, the vertex 25 will have
three adjacent vertices: 5, 15, 20. They are also found by
subtracting the notes values respectively. You should continue
doing that until you reach the value 0.

You might also like