(Node<T> n,
Cell<Node<T>> ancestors)
| 371 | } |
| 372 | |
| 373 | private static <T> Cell<Node<T>> successor(Node<T> n, |
| 374 | Cell<Node<T>> ancestors) |
| 375 | { |
| 376 | if (n.right != NullNode) { |
| 377 | n.right = new Node(n.right); |
| 378 | return minimum(n.right, new Cell(n, ancestors)); |
| 379 | } |
| 380 | |
| 381 | while (ancestors != null && n == ancestors.value.right) { |
| 382 | n = ancestors.value; |
| 383 | ancestors = ancestors.next; |
| 384 | } |
| 385 | |
| 386 | return ancestors; |
| 387 | } |
| 388 | |
| 389 | private static <T> Cell<Node<T>> predecessor(Node<T> n, |
| 390 | Cell<Node<T>> ancestors) |