From 2736307c1d6d67868ca54a3df951f9e959efedd0 Mon Sep 17 00:00:00 2001 From: rcoh Date: Mon, 20 Dec 2010 14:50:08 -0500 Subject: Util cleanup is done! Util.py is now refactored into the util module. Woo! RCOH --- util/Search.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 util/Search.py (limited to 'util/Search.py') diff --git a/util/Search.py b/util/Search.py new file mode 100644 index 0000000..25882da --- /dev/null +++ b/util/Search.py @@ -0,0 +1,8 @@ +from bisect import * +def find_le(a, x): + 'Find rightmost value less than or equal to x' + return bisect_right(a, x)-1 + +def find_ge(a, x): + 'Find leftmost value greater than x' + return bisect_left(a, x) -- cgit v1.2.3