Need Help with this Question or something similar to this? We got you! Just fill out the order form (follow the link below), and your paper will be assigned to an expert to help you ASAP.
QUESTION
Question 1 (True Love Triumphs) [15 marks]
As pointed out in the quiz 1, mermaid Ariel is deeply in love with human prince Eric.
However, King Triton is strongly against a marriage of Ariel and Eric and calls his royal
advisor Sebastien. Now, according to the laws of the undersea kingdom, marriages
are determined at a royal ball. The king must invite Ariel and Eric at the ball, but he
may also invite other mermen and mermaids, but always the same number of
mermen as of mermaids. The Gale-Shapley algorithm is carried out, and a stable
marriage is thus formed, matching each of the mermen and Eric with a mermaid.
Given that Ariel and Eric have each other at the top of their preference list, prove (by
contradiction) that no matter how Sebastien alters the order of mermen and Eric in
the Gale-Shapley algorithm, Ariel and Eric will match with each other.
Question 2 (Organise Science Day) [20 marks]
You are in charge of organising the Science day activities at UCD. A large number of
distinguished speakers have been invited by the organisers. During the Science day
that is scheduled for a Thursday afternoon, you have two slots for talks by these
speakers: 12pm to 1pm and 4pm to 5pm. This is not a problem per se because there
are a large number of venues for these talks all across the university. However, the
organisation team received a large number of requests from students that they would
like to attend talks by two different speakers live and therefore, they should be
scheduled in separate slots. Given speakers and such requests, give an
algorithm to (i) decide whether or not it is possible to schedule the speakers such that
all requests are satisfied and (ii) if it is possible to satisfy all requests, find a schedule
that does that. Prove the correctness of your algorithm and argue that it meets the
running time complexity requirement.
For instance, if a student wants to listen to speakers A and B, another wants to listen
to speakers B and C and a third wants to listen to speakers A and C, then it is not
possible to schedule these speakers to satisfy all requests. On the other hand, if an
attendee wants to listen to speakers A and B, another wants to listen to speakers B
and C, another wants to listen to speakers C and D and the last wants to listen to
speakers D and A, then A, C can be scheduled in the first slot and B, D can be
scheduled in the second slot and all requests can be satisfied.
Note that you can refer and use any lecture slide for designing and proving the
algorithm. You do not need to reproduce the lecture slides, just refer to it. But you
should carefully describe how you model the above problems in terms of something
that has been done in the lecture slides.
n m O(n + m)
Page 2 of 4
Question 3 (Generic Graph Traversal Algorithm) [20 marks]
Consider the following graph traversal algorithm:
TraverseGraph( )
Mark every vertex of as unexplored
= []
for every vertex
if not .explored
.append(TraverseFromVertex( ))
return
TraverseFromVertex( )
.explored = True
= []
= an empty edge collection
for
.add(( ))
while
.remove()
if not .explored
.explored = True
.append(( ))
for in .adj( )
.add(( ))
return
(i) Prove (by contradiction) that the structure returned by TraverseGraph( )
algorithm doesn’t contain any cycle.
(ii) Argue that the asymptotic complexity of this algorithm is if the edges can
be added and removed from in time.
(iii) What is the forest returned by the TraverseGraph( ) algorithm if the data
structure Q is (a) a FIFO queue and (b) a stack?
Sample Solutions
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.
Get sample solution
Order Now
Sed egestas, ante et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Morbi purus libero, faucibus adipiscing, commodo quis, gravida id, est. Sed lectus. Praesent elementum hendrerit tortor. Sed semper lorem at felis. Vestibulum volutpat, lacus a ultrices sagittis, mi neque euismod dui, eu pulvinar nunc sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.
Morbi interdum mollis sapien. Sed ac risus. Phasellus lacinia, magna a ullamcorper laoreet, lectus arcu pulvinar risus, vitae facilisis libero dolor a purus. Sed vel lacus. Mauris nibh felis, adipiscing varius, adipiscing in, lacinia vel, tellus. Suspendisse ac urna. Etiam pellentesque mauris ut lectus. Nunc tellus ante, mattis eget, gravida vitae, ultricies ac, leo. Integer leo pede, ornare a, lacinia eu, vulputate vel, nisl.
Suspendisse mauris. Fusce accumsan mollis eros. Pellentesque a diam sit amet mi ullamcorper vehicula. Integer adipiscing risus a sem. Nullam quis massa sit amet nibh viverra malesuada. Nunc sem lacus, accumsan quis, faucibus non, congue vel, arcu. Ut scelerisque hendrerit tellus. Integer sagittis. Vivamus a mauris eget arcu gravida tristique. Nunc iaculis mi in ante. Vivamus imperdiet nibh feugiat est.
Ut convallis, sem sit amet interdum consectetuer, odio augue aliquam leo, nec dapibus tortor nibh sed augue. Integer eu magna sit amet metus fermentum posuere. Morbi sit amet nulla sed dolor elementum imperdiet. Quisque fermentum. Cum sociis natoque penatibus et magnis xdis parturient montes, nascetur ridiculus mus. Pellentesque adipiscing eros ut libero. Ut condimentum mi vel tellus. Suspendisse laoreet. Fusce ut est sed dolor gravida convallis. Morbi vitae ante. Vivamus ultrices luctus nunc. Suspendisse et dolor. Etiam dignissim. Proin malesuada adipiscing lacus. Donec metus. Curabitur gravida