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: Add a new value to the tree with data assigned to it
  :param val: the new value to add to the tree
  :param data: the data that should be assigned to this value
  :return: None
docstr_tok: ["Add","a","new","value","to","the","tree","with","data","assigned","to","it",":","param","val",":","the","new","value","to","add","to","the","tree",":","param","data",":","the","data","that","should","be","assigned","to","this","value",":","return",":","None"]
code: def add(self, val: float, data: Any) -> None:
      """
      Add a new value to the tree with data assigned to it
      :param val: the new value to add to the tree
      :param data: the data that should be assigned to this value
      :return: None
      """
      self.data[self.next_leaf_idx_to_write] = data
      self.update(self.next_leaf_idx_to_write, val)
  
      self.next_leaf_idx_to_write += 1
      if self.next_leaf_idx_to_write >= self.size:
          self.next_leaf_idx_to_write = 0
  
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 5 for calling the SegmentTree obj's underlying member method code with example usage: obj.add(val, data) without return types