def move_last_element_of_predecessor_to_child(child_index)
      pred = @children[child_index - 1]
      child = @children[child_index]

      if child.is_leaf?
        # Adjust offset for the predecessor node
        @offsets[child_index] -= 1
        # Move the value
        child.values.unshift(pred.values.pop)
      else
        # Before:
        #
        # Root Node             +--------------------------------+
        # Offsets               | 0                           13 |
        # Children                |                            |
        #              pred       v                      child v
        # Level 1    +---------------------------------++-------------------+
        # Offsets    | 0         4         7        11 ||       0         3 |
        # Children     |         |         |         |          |         |
        #              v         v         v         v          v         v
        # Leaves  +---------++-------++----------++-------++----------++-------+
        # Values  | A B C D || E F G || H I J K  || L  M  || N  O  P  || Q  R  |
        #
        # Index     0 1 2 3    4 5 6    7 8 9 10    11 12    13 14 15    16 17
        #
        # After:
        #
        # Root Node             +--------------------------------+
        # Offsets               | 0                           11 |
        # Children                |                            |
        #              prepd      v                child       v
        # Level 1    +--------------------------++--------------------------+
        # Offsets    | 0         4         7    ||   0          2         5 |
        # Children     |         |         |         |          |         |
        #              v         v         v         v          v         v
        # Leaves  +---------++-------++----------++-------++----------++-------+
        # Values  | A B C D || E F G || H I J K  || L  M  || N  O  P  || Q  R  |
        #
        # Index     0 1 2 3    4 5 6    7 8 9 10    11 12    13 14 15    16 17
        #
        # Remove the last predecessor offset and update the child offset with
        # it
        delta = @offsets[child_index] - pred.offsets.last
        @offsets[child_index] = pred.offsets.pop
        # Adjust all the offsets of the child
        child.offsets.map! { |o| o += delta }
        # And prepend the 0 offset
        child.offsets.unshift(0)
        # Move the child reference
        child.children.unshift(pred.children.pop)
        child.children.first.parent = child
      end
    end
def move_last_element_of_predecessor_to_child(child_index)
      pred = @children[child_index - 1]
      child = @children[child_index]

      if child.is_leaf?
        # Adjust offset for the predecessor node
        @offsets[child_index] -= 1
        # Move the value
        child.values.unshift(pred.values.pop)
      else
        # Before:
        #
        # Root Node             +--------------------------------+
        # Offsets               | 0                           13 |
        # Children                |                            |
        #              pred       v                      child v
        # Level 1    +---------------------------------++-------------------+
        # Offsets    | 0         4         7        11 ||       0         3 |
        # Children     |         |         |         |          |         |
        #              v         v         v         v          v         v
        # Leaves  +---------++-------++----------++-------++----------++-------+
        # Values  | A B C D || E F G || H I J K  || L  M  || N  O  P  || Q  R  |
        #
        # Index     0 1 2 3    4 5 6    7 8 9 10    11 12    13 14 15    16 17
        #
        # After:
        #
        # Root Node             +--------------------------------+
        # Offsets               | 0                           11 |
        # Children                |                            |
        #              prepd      v                child       v
        # Level 1    +--------------------------++--------------------------+
        # Offsets    | 0         4         7    ||   0          2         5 |
        # Children     |         |         |         |          |         |
        #              v         v         v         v          v         v
        # Leaves  +---------++-------++----------++-------++----------++-------+
        # Values  | A B C D || E F G || H I J K  || L  M  || N  O  P  || Q  R  |
        #
        # Index     0 1 2 3    4 5 6    7 8 9 10    11 12    13 14 15    16 17
        #
        # Remove the last predecessor offset and update the child offset with
        # it
        delta = @offsets[child_index] - pred.offsets.last
        @offsets[child_index] = pred.offsets.pop
        # Adjust all the offsets of the child
        child.offsets.map! { |o| o += delta }
        # And prepend the 0 offset
        child.offsets.unshift(0)
        # Move the child reference
        child.children.unshift(pred.children.pop)
        child.children.first.parent = child
      end
    end
Move last element of predecessor node to child
 @param child_index [Integer] index of the child