Solution

ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2014/imperative-programming/3/d/solution

The level-zero successor of the predecessor is the first node whose value is at least x. Thus only one equality test remains.
def contains(x: Int): Boolean = {
  if (x == Int.MinValue || x == Int.MaxValue) false
  else {
    val n = findPreds(x)(0).nexts(0)
    (n ne tail) && n.datum == x
  }
}
In particular, the tail is never reported as a genuine member:
The additional work after the skip list search is constant.

New to topics? Read the docs here!