Question: Q 2 ( f ) ( 1 6 marks ) The manager of the restaurant is concerned about security so the developer has added a

Q2(f)(16 marks)
The manager of the restaurant is concerned about security so the developer has added a hashing algorithm to
encrypt the names before they are stored. This code is implemented in the function below:
def enc(t,c):
e =''
for ch in t:
if 'a'<= ch <='z':
e = e + c[ord(ch)- ord('a')]
else:
In []:
#Write your answer here
In []:
bookings_dict ={7: ('Howson',0,0),\
8: ('Howson',0,0),9: ('Linson',0,0),\
10: ('Linson',0,0),12: ('Hackett',0,1),\
13: ('Hackett',0,1),14: ('Hackett',0,1)}
#Write your answer here
#Run this code to ensure your code works
%run -i m269_util
test_table =[
['Single table',bookings_dict,1,"Linson"],
['Four tables',bookings_dict,4,"Hackett"],
]
test(#your_function_name, test_table)
e = e + ch
return e
Q2(f)(i)(8 marks)
The code above breaks a number of the guidance rules that you have been taught about in this module.
Identify four distinct rules that have been broken and explain why breaking this rule may be a problem.
Write your answer here
Q2(f)(ii)(8 marks)
Identify the complexity of the code in Q2(f) by name and in terms of Big Theta (\Theta ).(Assume that 'ord' has
constant complexity.) Explain and justify your reasoning.
Write your answer here
Submit this TMA by zipping together the notebook along with all of the helper and data files you have used, and
submitting your .zip file using the online TMA/EMA service

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!