
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

(a) Write out in pseudocode an Insert(SL, X) function which inserts an element into an existing skip list called SL and provide a brief explanation of how it works. You can assume a coin toss function CT which takes no arguments and returns a 1 or 0 with 50% probability of each. (b) What does the term with high probability mean when applied to a randomised algorithm? (c) Assume that for some reason the random number generator has broken so that instead of giving 1 or 0 with 50% probability it produces an alternating sequence of ones and zeros (i.e. 1 , 0 , 1 , 0 ,.. .). Discuss what difference this makes to the time complexity of the Insert and Search operations when compared to the standard skip list with a uniform random number generator.
(a) Assume that the vertices in G are on a line, that is the set of edges of G is
E = {(v 1 , v 2 ), (v 2 , v 3 ),... , (vnâ 1 , vn)}.
Give an efficient algorithm that returns the maximum weight of an independent subset S â V. Give the running time of your algorithm in big Oh notation. (b) Explain how to modify your algorithm to actually output an independent set S of maximum weight. (c) Assume that the number of vertices in the graph G is a multiple of 3, that is n = 3k for some integer k ⥠1. Argue that the weight of a maximal independent set should be at least k · wmin, where wmin is the minimal weight of vertices in V.