code: func (n *wrsNode) insert(item wrsItem, weight int64) int {
  	branch := 0
  	for n.items[branch] != nil && (n.level == 0 || n.items[branch].(*wrsNode).itemCnt == n.items[branch].(*wrsNode).maxItems) {
  		branch++
  		if branch == wrsBranches {
  			panic(nil)
  		}
  	}
  	n.itemCnt++
  	n.sumWeight += weight
  	n.weights[branch] += weight
  	if n.level == 0 {
  		n.items[branch] = item
  		return branch
  	}
  	var subNode *wrsNode
  	if n.items[branch] == nil {
  		subNode = &wrsNode{maxItems: n.maxItems / wrsBranches, level: n.level - 1}
  		n.items[branch] = subNode
  	} else {
  		subNode = n.items[branch].(*wrsNode)
  	}
  	subIdx := subNode.insert(item, weight)
  	return subNode.maxItems*branch + subIdx
  }
docs: // insert recursively inserts a new item to the tree and returns the item index