You are on page 1of 4

Answer Sheet

Please fill in the blanks with a different colour (like blue or red) and submit this
answer sheet (only) in a PDF format on Canvas.

Q1)
d
(a) f 1----, f 2 ----, f 3----, f 4 ----, f 5----, f 6---- [5 marks]
4 f
(b) ---- < ---- < ---- < ---- < ---- < ---- [5 marks]

Q2)
(a) Only after n=¿ ----------, f 2permanently exceeds f 1. [5 marks]

(b) First, we can calculate the gradients of each function:

'
f 1 ( n )=¿ --------------, f 2 ' ( n )=¿ --------------. [4 marks]

FORMCHECKBOX is possible
So, as n → ∞, so as long as c >0 , it for the
FORMCHECKBOX is not possible
long-term
growth rate of f 1 to exceed that of f 2. [1 mark]

Q3)
(a)
Performance in the best case (lower bound): (-------) [1 mark]
Performance in the worst case (upper bound): O(-------) [1 mark]
Tight bound (if it does not exist, leave it blank) (-------) [1 mark]
The return value (final x ): ------- [2 marks]

(b)
Performance in the best case (lower bound): (-------) [1 mark]
Performance in the worst case (upper bound): O(-------) [1 mark]
Tight bound (if it does not exist, leave it blank) (-------) [1 mark]
The return value (final x ): ------- [2 marks]

(c)
Case 1: if m > n:
Performance in the best case (lower bound): (-------) [1 mark]
Performance in the worst case (upper bound): O(-------) [1 mark]
Tight bound (if it does not exist, leave it blank) (-------) [1 mark]

Case 2: if n > m:
Performance in the best case (lower bound): (-------) [1 mark]
Performance in the worst case (upper bound): O(-------) [1 mark]
Tight bound (if it does not exist, leave it blank) (-------) [1 mark]
(d) Input: A=( a1 , … , an )
Output: Number of times a i+ ai+1=ai+2 , for all valid i until a
sequence (a i , ai +1 ,a i+2 ) contains an element with value 0.

Algorithm:

Write your pseudo-code here...

[8 marks]

Performance in the best case (lower bound): (-------) [1 mark]


Performance in the worst case (upper bound): O(n)
Tight bound (if it does not exist, leave it blank) (-------) [1 mark]

(e)
Program A:
Lower bound (if it is possible to guess): (-------) [1 mark]
Upper bound (if it is possible to guess): O(-------) [2 marks]
Tight bound (if it does not exist, leave it blank) (-------) [1 mark]

Program B:
Lower bound (if it is possible to guess): (-------) [1 mark]
Upper bound (if it is possible to guess): O(-------) [2 marks]
Tight bound (if it does not exist, leave it blank) (-------) [1 mark]
Q4)
(a)
Lower bound: (-------) [2 marks]
Upper bound: O(-------) [2 marks]
Tight bound (if exists): (-------) [1 mark]

(b)
FORMCHECKBOX yes
[1 mark].
FORMCHECKBOX no
The probability of doing so is ------- [3 marks],
FORMCHECKBOX small
and this value is when n is large [1 mark].
FORMCHECKBOX large

(c)
The key has n binary bits. So, the number of combinations is ------- [1 mark].
For a 1% chance of cracking the problem, we need to try ------- of the
combinations (all are equally probable) [1 mark]. We can calculate that in
30 days, there are ------- seconds [2 marks]. Each try takes 20 seconds. So,
in 30 days, that would allow ------- combinations to be tried [2 marks].
After a few steps of the calculation, finally, the minimum number of bits n
will be ------- [4 marks].

(d)
The key has n binary bits. So, the number of combinations is -------. For a
0.1% chance of cracking the problem, we need to try ------- of the
combinations (all are equally probable) [2 marks]. We know that in 30 days,
there are ------- seconds. Each try takes ------- seconds [2 marks]. Therefore,
in 30 days, that would allow ------- combinations to be tried [2 marks].
After a few steps of calculation, finally, the minimum number of bits n will
be ------- [4 marks].
Q5)
v1 v2 v3 v4 v5 v6 v7 v8
iteration 0       
1
2
3
4
5
6
7
8
[8 marks]
FORMCHECKBOX yes
Do you think the answer is correct? [1 mark].
FORMCHECKBOX no

Q6)

A B C D A B C D
iteration 0    iteration 0   
1 1
2 2
3 3
4 4

version 1 version 2
[2 marks] [2 marks]

FORMCHECKBOX version 1
Which result is correct? [1 mark].
FORMCHECKBOX version 2
Why? ------ [2 marks].

You might also like