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)
code: def __init__(self, size: int, operation: Operation):
      self.next_leaf_idx_to_write = 0
      self.size = size
      if not (size > 0 and size & (size - 1) == 0):
          raise ValueError(
              "A segment tree size must be a positive power of 2. The given size is {}".format(
                  self.size
              )
          )
      self.operation = operation
      self.tree = (
          np.ones(2 * size - 1) * self.operation.value["initial_value"]
      )
      self.data = [None] * size
  
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 1 to create a new SegmentTree object from inherited base classes: object with example: obj = SegmentTree(size, operation)