Question: Given the following algorithm that uses the Positional List abstract data type: Algorithm mystery(PL) Input a positional list, PL, of n elements Output ??? value

Given the following algorithm that uses the Positional List abstract data type: Algorithm mystery(PL) Input a positional list, PL, of n elements Output ??? value to current + PL.first() while current != null do x + current.getElement() if x % 2 = 0 then value + value + x current + PL.after(current) return value What is the worst-case runtime of the algorithm if the positional list is implemented as a doubly-linked list with sentinel head and tail references? OO(log2 n) OO(m2) OO(n) 00(1) OO(n)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
