2016FINALEXAM
2016FINALEXAM
Final Exam
Department: CS
60 Nine
Ten
Total Marks
2
Question (2) Analysis of Algorithms (10 points)
For each code fragment on the left, check the best matching order of growth of the
running time. You may use an answer more than once or not at all. Explain your
selection.
3
4
Question (3)- five sorting algorithms (10 points)
The column on the left is the original input of strings to be sorted the column on the
right are the strings in sorted order; the other columns are the contents at some
intermediate step during one of the algorithms listed below. Match up each algorithm
by writing its number under the corresponding column. Use each number exactly
once, explain your answer.
(0) Original input (1) Sorted (2) Selection sort (3) Insertion sort
(4) Shellsort (5) Mergesort (6) Quicksort
5
Question (4) insert the following number in a redblack tree (2,1,4,5,9,3,6,7)
, show each step and show the color of each node (10 points).
6
7
Question (5) Find longest common subsequence (LCS) BETWEEN Algorithm
and Alignment using daynamic programming Show detailed steps(10 points)
8
Question (6)- Find the shotrest path for the following graph from s to t (10
points)
9
10
Good Luck
Dr Basheer Youssef.
11