Find the level down to which to assign all nodes BLACK. This is the last `full' level of the complete binary tree produced by buildTree. The remaining nodes are colored RED. (This makes a `nice' set of color assignments wrt future insertions.) This level number is computed by finding the number of
(int sz)
| 1708 | * quick O(lg(N)) loop.) |
| 1709 | */ |
| 1710 | private static int computeRedLevel(int sz) { |
| 1711 | int level = 0; |
| 1712 | for (int m = sz - 1; m >= 0; m = m / 2 - 1) |
| 1713 | level++; |
| 1714 | return level; |
| 1715 | } |
| 1716 | |
| 1717 | } // class RBTreeMap |