Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algo(T, k)
- Stack S = Ø
- curr = T
- prev = next = NIL
- while (S ≠ Ø OR curr ≠ NIL) AND next ≠ NIL do
- if curr ≠ NIL then
- push(S, curr)
- curr = curr->sx
- else
- curr = pop(S)
- if curr->key < k then
- prev = curr
- if curr->key > k then
- next = curr
- curr = curr->dx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement