# True Love Triumphs

FIND A SOLUTION AT Academic Writers Bay

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 royaladvisor Sebastien. Now, according to the laws of the undersea kingdom, marriagesare determined at a royal ball. The king must invite Ariel and Eric at the ball, but hemay also invite other mermen and mermaids, but always the same number ofmermen as of mermaids. The Gale-Shapley algorithm is carried out, and a stablemarriage 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 (bycontradiction) that no matter how Sebastien alters the order of mermen and Eric inthe 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 ofdistinguished speakers have been invited by the organisers. During the Science daythat is scheduled for a Thursday afternoon, you have two slots for talks by thesespeakers: 12pm to 1pm and 4pm to 5pm. This is not a problem per se because thereare a large number of venues for these talks all across the university. However, theorganisation team received a large number of requests from students that they wouldlike to attend talks by two different speakers live and therefore, they should bescheduled in separate slots. Given speakers and such requests, give analgorithm to (i) decide whether or not it is possible to schedule the speakers such thatall requests are satisfied and (ii) if it is possible to satisfy all requests, find a schedulethat does that. Prove the correctness of your algorithm and argue that it meets therunning time complexity requirement.For instance, if a student wants to listen to speakers A and B, another wants to listento speakers B and C and a third wants to listen to speakers A and C, then it is notpossible to schedule these speakers to satisfy all requests. On the other hand, if anattendee wants to listen to speakers A and B, another wants to listen to speakers Band C, another wants to listen to speakers C and D and the last wants to listen tospeakers D and A, then A, C can be scheduled in the first slot and B, D can bescheduled in the second slot and all requests can be satisfied.Note that you can refer and use any lecture slide for designing and proving thealgorithm. You do not need to reproduce the lecture slides, just refer to it. But youshould carefully describe how you model the above problems in terms of somethingthat has been done in the lecture slides.n m O(n + m)Page 2 of 4Question 3 (Generic Graph Traversal Algorithm) [20 marks]Consider the following graph traversal algorithm:TraverseGraph( )Mark every vertex of as unexplored= []for every vertexif not .explored.append(TraverseFromVertex( ))returnTraverseFromVertex( ).explored = True= []= an empty edge collectionfor.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 canbe added and removed from in time.(iii) What is the forest returned by the TraverseGraph( ) algorithm if the datastructure Q is (a) a FIFO queue and (b) a stack?GGFu ∈ GuF G, uFG, uuTQv ∈ G . a d j(u)Q u, vQ ≠ ∅(v,w) = QwwT v,wx G wQ w, xTF GO(n + m)Q O(1)GPage 3 of 4Question 4 (Long Paths on DAGs) [20 marks]Let be a directed acyclic graph with vertices and edges.(a) A Hamiltonian path in is a directed path in that contains every vertex in .Give an algorithm to determine whether has a Hamiltonian path.(b) Suppose we are given an integer . Give an algorithm to find whether ornot there exists a directed path with or more edges in .Question 5 (Simplified SCC Algorithm) [15 marks]The Kosaraju-Sharir algorithm shown in the lecture worked as follows:• Perform DFS( ) to compute finish times for all vertices• Compute• For each vertex in in reverse order of finish time• Run DFS-Visit( ) in and label all vertices in its DFS tree as a separate SCCWhile teaching this algorithm, Dr. Ajwani found the above algorithm to be quiteconfusing for students. So, he simplified the algorithm as follows:• Perform DFS( ) to compute finish times for all vertices• For each vertex in in increasing order of finish time• Run DFS-Visit( ) in and label all vertices in its DFS tree as a separate SCCNote that the simplified algorithm processes vertices in increasing order of finish timeinstead of the reverse order and performs DFS-Visit in , instead of . Give acounter-exle to show that the algorithm as modified by Dr. Ajwani does notproduce all the strongly connected components correctly.Question 6 (Number of Paths) [20 marks]It has happened many a times that the shortest path that you took from your home toUCD was blocked because of road works and the detours were really long. So, youhave decided that instead of relying on only one shortest path, you want to havemany shortest paths between your home and UCD. Give an algorithm tocompute how many shortest paths exists between your home and UCD. Here, is thenumber of intersections and is the number of roads between them. You can assumethat all edge weights are 1.

The capital (previously the finance) account concerns the nation’s long term transactions between the rest of the world. This includes buying and selling non-produced non-current assets (e.g. land, trademarks and copyrights) and capital transfers. Errors and Omissions: As mistakes and miscalculations can occur, there are sometimes errors and omissions. This section takes account for these types of mistakes. The UK current account in quarter 4 of 2017 was -18,443(GBP million). This is a poor current account figure for a nation, but has been recovering since quarter 2, where the current account was -25,639 (GBP million). Quarter 4 of 2018 was the best UK current account since 2012. The capital account in quarter 4 of 2017 was 41,517 (GBP million). This means that there was 41,517 (GBP million) more investment into the UK from other nations than what there was of the UK investing abroad. Errors and omissions in quart 4 of 2017 was -8,499 ( GBP million). This is the margin of inaccurate calculations and information that was missing. 8. The following graph is a visual representation of the trends of the current balance for the UK in the last 30 years. The graph illustrates that the UK’s account has decreased majorly in the past 30 years. The account had been somewhat stable until 2007-2008 when it experienced a trough due to the global ‘credit crunch’ occurred, leading to the nation experiencing a recession (known as the great regt;

QUALITY: ORIGINAL PAPER NO PLAGIARISM - CUSTOM PAPER

## Why Choose Us?

• non-plagiarized Papers
• Affordable Prices
• Any Paper, Urgency, and Subject
• Will complete your papers in 6 hours
• On-time Delivery
• Money-back and Privacy guarantees
• Unlimited Amendments upon request
• Satisfaction guarantee

## How It Works

• Click on the “Place Your Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
• Fill in your paper’s requirements in the "PAPER DETAILS" section.