package main import "fmt" type segment struct { length int64 data []int64 } func newSegment(length int64) * segment { s := &segment { length , make([]int64,1,8) } s.data[0] = length return s } func (s *segment) insert(from int64 , size int64) (large bool) { large = false if size <= 0 { panic("invalid argment") } if from > s.length { panic("invalid argment") } if from < 0 { panic("invalid argment") } end := from + size if end > s.length { panic("invalid argment") } var i int for i=0;i