0% found this document useful (0 votes)
28 views12 pages

2016FINALEXAM

This document is a final exam for an Algorithms course. It contains 10 multiple choice and short answer questions testing a variety of algorithm topics: 1) Minimum spanning tree algorithms and determining which algorithms could produce given partial spanning trees. 2) Analyzing the time complexity of code fragments using asymptotic notation. 3) Matching sorting algorithms to intermediate steps sorting a list of strings. 4) Demonstrating the steps of inserting a number into a red-black tree. 5) Finding the longest common subsequence between two words using dynamic programming. 6) Finding the shortest path between nodes s and t on a graph. The exam is out

Uploaded by

Ahmed Mabrok
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views12 pages

2016FINALEXAM

This document is a final exam for an Algorithms course. It contains 10 multiple choice and short answer questions testing a variety of algorithm topics: 1) Minimum spanning tree algorithms and determining which algorithms could produce given partial spanning trees. 2) Analyzing the time complexity of code fragments using asymptotic notation. 3) Matching sorting algorithms to intermediate steps sorting a list of strings. 4) Demonstrating the steps of inserting a number into a red-black tree. 5) Finding the longest common subsequence between two words using dynamic programming. 6) Finding the shortest path between nodes s and t on a graph. The exam is out

Uploaded by

Ahmed Mabrok
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Cairo University

Faculty of Computers and Information

Final Exam

Department: CS

Course Title: Algorithms


Course Code: CS316
Semester: 2
Instructor: Dr- Basheer Abdel Fattah Youssef
Date: 6/6/2016
Exam Duration: 2 Hours

Question Mark Signature


One
Two
Three
Four
Five
Six
Seven
Eight

60 Nine
Ten

Total Marks

Total Marks in Writing:


1
Question (1)Minimum Spanning Tree Algorithms (12 points)
Each of the figures below represents a partial spanning tree. Determine whether it
could possibly be obtained from,Prim’s algorithm, Kruskal’s algorithm, both or
neither.

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 deer bass bass bear bear bull bass


1 clam bull bear bull bull clam bear
2 bear bear bull calf calf bear bull
3 myna crow calf clam clam bass calf
4 tuna deer clam deer deer crow clam
5 slug clam crab dove dove crab crab
6 dove calf crow gnat lynx calf crow
7 moth dove deer lynx moth deer deer
8 lynx hoki dove moth myna lynx dove
9 bull duck duck myna slug moth duck
10 calf crab gnat pony sole dove gnat
11 sole mule hoki seal tuna sole hoki
12 pony moth pony slug gnat pony lion
13 seal lynx seal sole hoki seal lynx
14 gnat gnat myna swan mule gnat moth
15 swan puma swan tuna pony swan mule
16 mule myna mule mule seal mule myna
17 hoki seal sole hoki swan hoki pony
18 duck lion tuna duck bass duck puma
19 crab sole slug crab crab slug seal
20 crow pony lynx crow crow tuna slug
21 bass tuna moth bass duck myna sole
22 lion slug lion lion lion lion swan
23 puma swan puma puma puma puma tuna
---- ---- ---- ---- ---- ---- ----
0 1

(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

You might also like