aboutsummaryrefslogtreecommitdiff
path: root/util/Search.py
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2011-01-27 16:50:59 -0500
committerGravatar rcoh <rcoh@mit.edu>2011-01-27 16:50:59 -0500
commit5fb3ea060025241105dc8e9a174513c112f9a133 (patch)
treee98b1b3eab0b05b0e518b08cbab086d224fd9250 /util/Search.py
parent5d29906fff79bc6e4ba83be7028e1380a0014d21 (diff)
A metric $#%$-ton of changes. Added doc-strings to EVERYTHING. Phew. Fixed a massive bug that
increases performance in by up to a factor of 60. A bunch of new behaviors for the class.
Diffstat (limited to 'util/Search.py')
-rw-r--r--util/Search.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/util/Search.py b/util/Search.py
index f7e4b81..1499e23 100644
--- a/util/Search.py
+++ b/util/Search.py
@@ -1,13 +1,13 @@
from bisect import *
def find_le(a, x):
- 'Find rightmost value less than or equal to 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'
+ """Find leftmost value greater than x"""
return bisect_left(a, x)
-#returns parents of nodes that meed a given condition
def parental_tree_search(root, childrenstr, conditionstr):
+ """Returns parents of nodes that meed a given condition"""
ret = []
queue = [root]
while queue: