next up previous
Next: Sorted Double List with Up: CSE 2320: Algorithms and Previous: Sentinels

Unsorted Double List with Sentinel

      next(x) = next(nil(L))
      prev(next(x)) = x
      next(nil(L)) = x
      prev(x) = nil(L)

      x = next(nil(L))
      while x <> nil(L)  and  key(x) <> k
         x = next(x)
      return x

      next(prev(x)) = next(x)
      prev(next(x)) = prev(x)

Max, Min, Successor, Predecessor: same as unsorted single lists except nil(L) replaces head(L)

Copyright © 1998 The University of Texas at Arlington