class_docstr: A SegmentTree with the reduction `operation`=operator.add.
class_docstr_tok: ["A","SegmentTree","with","the","reduction","`","operation","`","=operator.add","."]
docstr: Finds highest i, for which: sum(arr[0]+..+arr[i - i]) <= prefixsum.
  
  Args:
      prefixsum: `prefixsum` upper bound in above constraint.
  
  Returns:
      int: Largest possible index (i) satisfying above constraint.
docstr_tok: ["Finds","highest","i",",","for","which",":","sum","(","arr","[","0","]","+","..","+arr","[","i","-","i","]",")","<","=","prefixsum",".","Args",":","prefixsum",":","`","prefixsum","`","upper","bound","in","above","constraint",".","Returns",":","int",":","Largest","possible","index","(","i",")","satisfying","above","constraint","."]
code: def find_prefixsum_idx(self, prefixsum: float) -> int:
      """Finds highest i, for which: sum(arr[0]+..+arr[i - i]) <= prefixsum.
  
      Args:
          prefixsum: `prefixsum` upper bound in above constraint.
  
      Returns:
          int: Largest possible index (i) satisfying above constraint.
      """
      assert 0 <= prefixsum <= self.sum() + 1e-5
      # Global sum node.
      idx = 1
  
      # While non-leaf (first half of tree).
      while idx < self.capacity:
          update_idx = 2 * idx
          if self.value[update_idx] > prefixsum:
              idx = update_idx
          else:
              prefixsum -= self.value[update_idx]
              idx = update_idx + 1
      return idx - self.capacity
  
file_path: ray/rllib/execution/segment_tree.py
imports: import operator
  from typing import Any, Optional
label_desc: Use image node_id 3 for calling the SumSegmentTree obj's underlying member method code with example usage: obj.find_prefixsum_idx(prefixsum) and returns: unknown