Question: Consider the following algorithm for decreasing cycle length: Choose an arbitrary cycle v1 v2vnv1. Go through i=1 to i=n1 and check if swapping any vi

 Consider the following algorithm for decreasing cycle length: Choose an arbitrary

Consider the following algorithm for decreasing cycle length: Choose an arbitrary cycle v1 v2vnv1. Go through i=1 to i=n1 and check if swapping any vi and vi+1 will yield a shorter cycle; swapping them if so. After i=n1, check if swapping vn and v1 will yield a shorter cycle, swapping them if so. Start again at i=1 and stop when you've checked n times consecutively without a swap occurring. i. Each check requires calculating the new total cycle length, where each mathematical operation requires a tiny amount of time. What is the fastest way we could do this check at each stage? [1 mark] ii. Demonstrate an implementation of this algorithm on the following graph, beginning with the cycle A>B>C>D>A. [3 marks] AB(9),AD(10),BC(11),BD(6),CD(13) iii. Construct a graph where this algorithm does not work. That is, it does not give the shortest n-cycle. [2 marks]

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!