Solution

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

Assume NumLevels >= 1. Both sentinel nodes occur on every level; the tail ends every linked list.
val head = new Node(Int.MinValue)
val tail = new Node(Int.MaxValue)
for (level <- 0 until NumLevels) {
  head.nexts(level) = tail
  tail.nexts(level) = null
}
The empty skip list therefore has
The forbidden data values distinguish the sentinel nodes from genuine entries.

New to topics? Read the docs here!