Question: Problem 4 . The main difference between an array and a linked list is that arrays support random access efficiently: one can lookup the i-th

 Problem 4 . The main difference between an array and a

Problem 4 . The main difference between an array and a linked list is that arrays support random access efficiently: one can lookup the i-th value in an array in constant time. Many algorithms such as BINABYSEARCH rely on random access. P4.1. Provide an algorithm Ger(L,i) that returns the i-th value in linked list L. What is the complexity of this algorithm? P4.2. Consider the algorithm BinarySEARCH from the slides. What is the average complexity of this algorithm to search for a value vL when list L is represented by a linked lists (using the above GET algorithm to implement L[mid] ). Feel free to assume that the length of the list is an exact power of two if that simplifies your argument

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!