Professional Documents
Culture Documents
SE214 Mid-Term Fall 2020
SE214 Mid-Term Fall 2020
2. Write C code to find the first 7 Fibonacci numbers using recursion. Also print, how 4
many times the Fibonacci function called for the 3rd Fibonacci number (3rd fib is 2)
during a recursive call. Compare the dynamic programming approach and recursive
solution to find out Fibonacci series.
3. In the pandemic situation, you are staying at home. Your brother is asking about 5
academic progress and becomes happy hearing that you are doing good in the
algorithm course. So, he wants to test your skill in this course.
He asked you to find out the matches Letters between your name and your father's
name. Then, he told you to find out the process by which you can find the Longest
matching subsequence.
Now, your task is to examine and analyze the above story, then determine the
appropriate procedure and show every step to find out the longest matching
subsequence to find out matches letters.
4. Dhaka Stock Exchange (DSI) is the largest stock exchange in Bangladesh.
Thousands of people are investing their capital. In the last week, 7 billions of BDT
has exchanged in the first day, 6 billions in the second day, 8 billions in the next day,
5 billions in the next day and 7 billions in the last day of the week.
Investors should be aware of the up and down of the market. So your task is to write
a procedure that will find out the low point(s) of the week. Low point refers to the
value that is lower compared to his previous and next value. Here 6 and 5 are the
low values.
Analyze the above story and determine the procedure which will be able to work in 4
any given week data. Write corresponding C code and also mention the complexity +
of your code. 2
Sample input: 7 6 8 5 7 Output: 6 5
Sample input: 5 6 1 3 2 Output: 5 1 2
5. What do you mean by dynamic algorithms approach? Define the following terms 4
with proper explanation and examples:
● Overlapping subproblems
● Optimal substructure
● Subproblem Dependencies
● Memorization