Docsity

Extended Euclidean Algorithm, Shortest Paths-Algorithm Design and Data Representation-Exam Paper, Exams of Data Representation and Algorithm Design

Toggle sidebar
bg1
COMP202 Class Exam 2
Complexity of Algorithms 29 April 2009
NB: Maximum possible marks = 50. Duration: 50 minutes.
NB: Exam contributes 10% to overall course mark.
Answer all questions!
1. Use the Extended Euclidean algorithm (demonstrate the steps) to
(a) find d= gcd(306,264) [5 marks]
(b) find integers jand ksuch that d=j·306 + k·264. [5 marks]
2. Find shortest paths from vertex Ato all other vertices in the directed
graph below. Also, find the predecessor array for the paths, i.e. the vector
that will allow you to reconstruct a shortest path from Ato any other
vertex in the digraph. [10 marks]
3. Let p= 17, q= 13, and e= 5.
(a) Describe the procedure you would use to encode the message M=
100 using the RSA encryption procedure. (You need not actually
compute this number, just tell me how you would do it.) [5 marks]
(b) What is the decryption key dfor the given values of p, q, and e?[5
marks]
1
docsity.com
pf2

Partial preview of the text

Download Extended Euclidean Algorithm, Shortest Paths-Algorithm Design and Data Representation-Exam Paper and more Exams Data Representation and Algorithm Design in PDF only on Docsity!

COMP202 Class Exam 2 Complexity of Algorithms 29 April 2009

NB: Maximum possible marks = 50. Duration: 50 minutes. NB: Exam contributes 10% to overall course mark.

Answer all questions!

  1. Use the Extended Euclidean algorithm (demonstrate the steps) to

(a) find d = gcd(306, 264) [5 marks] (b) find integers j and k such that d = j · 306 + k · 264. [5 marks]

  1. Find shortest paths from vertex A to all other vertices in the directed graph below. Also, find the predecessor array for the paths, i.e. the vector that will allow you to reconstruct a shortest path from A to any other vertex in the digraph. [10 marks]
  2. Let p = 17, q = 13, and e = 5.

(a) Describe the procedure you would use to encode the message M = 100 using the RSA encryption procedure. (You need not actually compute this number, just tell me how you would do it.) [5 marks] (b) What is the decryption key d for the given values of p, q, and e? [ marks]

docsity.com

  1. Consider the flow network H below with source s and sink t. The edge capacities are the (unboxed) numbers given near each edge. The boxed numbers give a flow defined on this network. (a) Draw the residual network for the given flow. [4 marks] (b) Find a maximum flow in this network. (Note: The given flow is not a maximum flow.) Once you have done this, draw a copy of the original network H and clearly indicate the flow on each edge of H in your maximum flow. [4 marks] (c) Find a minimum s-t cut in the network, i.e. name the two (non- empty) sets of vertices that define a minimum cut. [ marks]
  2. (a) List all of the minimum s-t cuts in the network N shown below. The edge capacities are shown near each edge. [5 marks]

i

i

i

 i

HH

HH

Hj

HH

HH

Hj

s

u

w

t

(b) Suppose that x is some integer, and you want to compute x^37. You can obviously do this using 36 multiplication operations. How can you find x^37 using fewer than 36 multiplications? Find the smallest number of multiplications necessary to do this. (You may assume you can store as many intermediate values as you like during your computations.) [5 marks]

docsity.com