next up previous
Next: Doubly-Linked List Up: CSE 2320: Algorithms and Previous: Sorted List

Sorted List

   Min(L)
      return head(L)

   Max(L)
      x = head(L)
      if x <> NIL
      then while next(x) <> NIL
           x = next(x)
      return x


   Delete(L,x)
      ; same

   Successor(L,x)
      return next(x)

   Predecessor(L,x)
      p = NIL
      y = head(L)
      while y <> NIL and y <> x
         p = y
         y = next(y)
      return p



Copyright © 1998 The University of Texas at Arlington