Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pike 0.30 KB | None | 0 0
  1. Algo(T, k)
  2.     Stack S = Ø
  3.     curr = T
  4.     prev = next = NIL
  5.    
  6.     while (S ≠ Ø OR curr ≠ NIL) AND next ≠ NIL do
  7.         if curr ≠ NIL then
  8.             push(S, curr)
  9.             curr = curr->sx
  10.         else
  11.             curr = pop(S)
  12.             if curr->key < k then
  13.                 prev = curr
  14.             if curr->key > k then
  15.                 next = curr
  16.             curr = curr->dx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement