Professional Documents
Culture Documents
55, 9, .., 28, 15, 16, 6) - Her Task Is To Check Whether A Client Exists in The List or
55, 9, .., 28, 15, 16, 6) - Her Task Is To Check Whether A Client Exists in The List or
55, 9, .., 28, 15, 16, 6) - Her Task Is To Check Whether A Client Exists in The List or
boxes of precious stones from Africa to Europian clients. The company aims to
maximise the number of items enter in a box (to maximise profit) so they are
willing to break stones in small pieces to add as many as they can into a single box.
Consider the following use case: Mary wants to develop an algorithm to search for a
client-id in a list of unique client-ids. The client list looks like this clients = [ 11, 3,
55, 9, .., 28, 15, 16, 6]. Her task is to check whether a client exists in the list or
not. Mary is not sure what is the best way to approach this.
Does she need to (a) sort the list and then search it or (b) search the list directly
(without sorting)?
What do you suggest to Mary to do? What is the computational complexity in
both cases (a and b)?
Merge sort is a XXXXXXX algorithm that divides input array into two halves, calls itself for the two
halves and then merges the two sorted halves.
The secretary problem is an XXXXXXXXX strategy problem of choosing a time to take a particular
action, to maximize an expected reward or minimize an expected cost. (1 mark)
One of the best algorithms to search for a key in a list of sorted elements is the binary search
algorithm. The worst-case computational complexity of the algorithm is XXXXXXX . (1 mark)
A XXXXXXXXX is a special relational database table column (or combination of columns)
designated to identify all table records uniquely. In contrast, a XXXXXXXXX acts as a cross-
reference link between data in tables. (2 marks)
Gradient descent is an algorithm we often need to use to optimise a cost function.
In machine learning, we use gradient descent to update the parameters of our
model.
In your own words discuss how gradient descent algorithm works. Provide a simple
example where gradient descent can help you solve a data science problem.
https://www.youtube.com/watch?v=sDv4f4s2SB8
Q 3. Search for films that have a runtime of 100 minutes or more
Q 4. Change the runtime of the film with the id 104 to 97 minutes
Q 9. Search for films with a running time more than 100 and less than
200 minutes.
Harry gets a wand 11’’ and with ‘a phoenix feather core: O(n) [Linear time] Linear
search. The running time of an algorithm typically grows with the input size: n.
Naïve sorting: O(𝑛^2)operations: Compare each item with every item in the list!