class_docstr: A tree which can be used as a min/max heap or a sum tree
  Add or update item value - O(log N)
  Sampling an item - O(log N)
docstr: Retrieve the first node that has a value larger than val and is a child of the node at index idx
  :param root_node_idx: the index of the root node to search from
  :param val: the value to query for
  :return: the index of the resulting node
docstr_tok: ["Retrieve","the","first","node","that","has","a","value","larger","than","val","and","is","a","child","of","the","node","at","index","idx",":","param","root_node_idx",":","the","index","of","the","root","node","to","search","from",":","param","val",":","the","value","to","query","for",":","return",":","the","index","of","the","resulting","node"]
code: def _retrieve(self, root_node_idx: int, val: float) -> int:
      """
      Retrieve the first node that has a value larger than val and is a child of the node at index idx
      :param root_node_idx: the index of the root node to search from
      :param val: the value to query for
      :return: the index of the resulting node
      """
      left = 2 * root_node_idx + 1
      right = left + 1
  
      if left >= len(self.tree):
          return root_node_idx
  
      if val <= self.tree[left]:
          return self._retrieve(left, val)
      else:
          return self._retrieve(right, val - self.tree[left])
  
imports: import operator
  import random
  from enum import Enum
  from typing import List, Tuple, Any
  import numpy
  from rl_coach.core_types import Transition
  from rl_coach.memories.memory import MemoryGranularity
  from rl_coach.memories.non_episodic.experience_replay import ExperienceReplayParameters, ExperienceReplay
  from rl_coach.schedules import Schedule, ConstantSchedule
label_desc: Use image node_id 3 for calling the SegmentTree obj's underlying member method code with example usage: obj._retrieve(root_node_idx, val) and returns: root_node_idx, self, self