@Test(expected = IllegalArgumentException.class) public void testInvalidInput3() { RangeSearchBST<Integer, Integer> test = new RangeSearchBST<>(); test.size(0, null); }
public int size(Key lo, Key hi) { if (lo == null || hi == null || lo.compareTo(hi) > 0) throw new IllegalArgumentException("input is not valid"); if (contains(hi)) return rank(hi) - rank(lo) + 1; return rank(hi) - rank(lo); }
RangeSearchBST extends RedBlackBSTWithNoExtraMemory<Key, Val> { public int size(Key lo, Key hi) { if (lo == null || hi == null || lo.compareTo(hi) > 0) throw new IllegalArgumentException("input is not valid"); if (contains(hi)) return rank(hi) - rank(lo) + 1; return rank(hi) - rank(lo); } }
RangeSearchBST extends RedBlackBSTWithNoExtraMemory<Key, Val> { public int size(Key lo, Key hi) { if (lo == null || hi == null || lo.compareTo(hi) > 0) throw new IllegalArgumentException("input is not valid"); if (contains(hi)) return rank(hi) - rank(lo) + 1; return rank(hi) - rank(lo); }  }
RangeSearchBST extends RedBlackBSTWithNoExtraMemory<Key, Val> { public int size(Key lo, Key hi) { if (lo == null || hi == null || lo.compareTo(hi) > 0) throw new IllegalArgumentException("input is not valid"); if (contains(hi)) return rank(hi) - rank(lo) + 1; return rank(hi) - rank(lo); }  int size(Key lo, Key hi); List<Key> search(Key lo, Key hi); }
RangeSearchBST extends RedBlackBSTWithNoExtraMemory<Key, Val> { public int size(Key lo, Key hi) { if (lo == null || hi == null || lo.compareTo(hi) > 0) throw new IllegalArgumentException("input is not valid"); if (contains(hi)) return rank(hi) - rank(lo) + 1; return rank(hi) - rank(lo); }  int size(Key lo, Key hi); List<Key> search(Key lo, Key hi);  }