0% found this document useful (0 votes)
34 views

Final - Exam - 2018 - PHD

This document contains a PhD qualification exam covering algorithms. It consists of 9 questions testing various algorithm topics like recurrences, asymptotic analysis, sorting, graph algorithms, data structures, and dynamic programming. Questions involve analyzing algorithm running times, solving recurrences, implementing sorting and graph algorithms like merge sort, prim, dijkstra, red-black trees, and a coin collection dynamic programming problem. Students are asked to derive solutions, run times, and space complexities for the algorithms.

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 DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Final - Exam - 2018 - PHD

This document contains a PhD qualification exam covering algorithms. It consists of 9 questions testing various algorithm topics like recurrences, asymptotic analysis, sorting, graph algorithms, data structures, and dynamic programming. Questions involve analyzing algorithm running times, solving recurrences, implementing sorting and graph algorithms like merge sort, prim, dijkstra, red-black trees, and a coin collection dynamic programming problem. Students are asked to derive solutions, run times, and space complexities for the algorithms.

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 DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Faculty of Computers and Information - Cairo University

PhD Qualification Exam


Program :PhD
Course Name: Algorithms Date: 18-10-2018
Course Code: Duration: 3 Hours
Examiner : DR/ Basheer Youssef Dr/ ameen Total:100

Q1 (5 points) compute the following recurrence

T(1) =50. T(n) = 4T(n/8) +2n for n = 64.

Q2 (5 points) Arrange the following functions in increasing order of growth rate


a)n2log(n) b)2n c)22^n d) nlog(n) e)n2

Q3 (15 points) Using master method and substitution method to solve

A. T(n) = 4T(n/2) + n (4 points)


B.
T(n) = 4T(n/2) + n2 (4 points)

C. T(n) = 4T(n/2) + n3 (4 points)

Q4 [20 marks]

I. Suppose you are choosing between the following three algorithms: [15 marks]
1. Algorithm A solves problems by dividing them into five sub problems of half the size,
recursively solving each sub problem, and then combining the solutions in linear time.
2. Algorithm B solves problems of size n by recursively solving two sub problems of size
n − 1 and then combining the solutions in constant time.
3. Algorithm C solves problems of size n by dividing them into nine sub problems of size
n/3, recursively solving each sub problem, and then combining the solutions in O(n 2 )
time.
What are the running times of each of these algorithms (in big-O notation), and which would you
choose?

II. 3-way-Merge Sort: Suppose that instead of dividing in half at each step of Merge Sort,
you divide into thirds, sort each third, and finally combine all of them using a three-way
merge subroutine. What is the overall asymptotic running time of this algorithm? (Hint:
Note that the merge step can still be implemented in O(n) time.)
[5 marks]
Q5 [15marks] Get MST using prim and Kruskal [7.5 for each one]

start
12 8

2 9 1 9

5 3 11

8 7 3 5

1 10

Q6 [10 marks] Get shortest paths from node S to each node using Dijkstra algorithm

Q7[10marks] insert the following numbers in a redblack tree (5,1,4,10,9,20,6,7)

, show each step and show the color of each node and its BH.

Q8 [10 marks] Construct variable length code using Huffman for the following characters statistics A =
20 , B =30 , C = 15 , D=5, E=8, and F=22 .
Q9 [10 marks] several coins are placed in cells of an n × m board. A robot, located in the upper left cell
of the board, needs to collect as many of the coins as possible and bring them to the bottom
right cell. On each step, the robot can move either one cell to the right or one cell down from its
current location. Design A DP Algorithm to solve this problem, and what is its space and time
complexity and use the following counter example to apply your algorithm and what is the
maximum number of coins that robot can collect it

1 2 3 4 5 6

With my best wishes

You might also like