class IntervalSkipList
def insert(range, marker)
def insert(range, marker) ranges[marker] = range first_node = insert_node(range.first) first_node.endpoint_of.push(marker) last_node = insert_node(range.last) last_node.endpoint_of.push(marker) cur_node = first_node cur_level = first_node.top_level while next_node_at_level_inside_range?(cur_node, cur_level, range) while can_ascend_from?(cur_node, cur_level) && next_node_at_level_inside_range?(cur_node, cur_level + 1, range) cur_level += 1 end cur_node = mark_forward_path_at_level(cur_node, cur_level, marker) end while node_inside_range?(cur_node, range) while can_descend_from?(cur_level) && next_node_at_level_outside_range?(cur_node, cur_level, range) cur_level -= 1 end cur_node = mark_forward_path_at_level(cur_node, cur_level, marker) end end