itzyagirlshy
itzyagirlshy
16.04.2020 • 
Mathematics

You are given a sorted circular linked list containing n integers, where every element has a "next" pointer to the next larger element. The largest element's "next" pointer points to the smallest element.) You are asked to determine whether a given target element belongs to the list. There are only two ways you can access an element of the list: (1) to follow the next pointer from a previously accessed element, or (2) via a given function RAND that returns a pointer to a uniformly random element of the list. Develop a randomized algorithm for finding the target that makes at most O(Vn) comparisons in expec- tation and always returns the correct answer. Hint: Your algorithm will perform some random accesses and some amount of linear search. Use part a) to analyze the number of steps in the linear search.)

Solved
Show answers

Ask an AI advisor a question