func insert(x0 *Table, w int, sl []int, r Route) bool {
	level := 0
	ss := 0  
	x := x0  
	rp := r.RouteParams()
	if rp.Addr == 0 && rp.Len == 0 {
		if x.r[1] != nil {
			return false  
		}
		x.r[1] = r  
		return true
	}
	var s uint64  
	for {
		ss += sl[level]
		s = (rp.Addr >> (rp.Width - ss)) & ((1 << sl[level]) - 1)
		if rp.Len <= ss {
			break
		}
		i := fringeIndex(sl[level], s)
		if x.n[i] == nil {
			child := NewTable(sl[level+1])  
			x.n[i] = child
			child.parentPtr = &x.n[i]
			x.ref++
		}
		x = x.n[i]
		level++
	}
	ss -= sl[level]
	if x.insertSingle(RouteParams{Width: sl[level], Addr: s, Len: rp.Len - ss}, r) {
		x.ref++  
		return true
	}
	return false
}
insert is multi-level insertion ("Algorithm 5).

w: width of address
sl: stride length by level

It reports whether the insertion was successful.
package art
func baseIndex(width int, addr uint64, prefixLen int) uint64 {
	return (addr >> uint64(width-prefixLen)) + (1 << uint64(prefixLen))
}
func fringeIndex(width int, addr uint64) uint64 {
	return baseIndex(width, addr, width)
}
type Route interface {
	RouteParams() RouteParams
}
type RouteParams struct {
	Width int     
	Addr  uint64  
	Len   int     
}
func (p RouteParams) baseIndex() uint64 { return baseIndex(p.Width, p.Addr, p.Len) }
type Table struct {
	w  int    
	sl []int  
	r         []Route
	n         []*Table  
	ref       int       
	parentPtr **Table   
}
func (x *Table) free() {
	if x.parentPtr != nil {
		*x.parentPtr = nil
		x.parentPtr = nil
	}
}
func (x *Table) clone() *Table {
	if x == nil {
		return nil
	}
	x2 := &Table{
		w:         x.w,
		sl:        x.sl,
		ref:       x.ref,
		r:         x.r,
		parentPtr: x.parentPtr,
	}
	if x.n != nil {
		x2.n = make([]*Table, len(x.n))
		for i, v := range x.n {
			x2.n[i] = v.clone()
		}
	}
	return x2
}
func NewTable(stride int) *Table {
	n := 1 << (stride + 1)
	return &Table{
		r: make([]Route, n),
		n: make([]*Table, n),
	}
}
func (x *Table) allot(smallestFringeIndex uint64, b uint64, q, r Route) {
	t := smallestFringeIndex
	if x.r[b] == q {
		x.r[b] = r
	} else {
		return
	}
	if b >= smallestFringeIndex {
		return
	}
	b = b << 1
	x.allot(t, b, q, r)  
	b++
	x.allot(t, b, q, r)  
}
func (x *Table) insertSingleLevel(r Route) bool {
	return x.insertSingle(r.RouteParams(), r)
}
func (x *Table) insertSingle(rp RouteParams, r Route) bool {
	b := rp.baseIndex()
	xb := x.r[b]
	if xb != nil {
		xbP := xb.RouteParams()
		if rp.Addr == xbP.Addr && rp.Len == xbP.Len {
			return false  
		}
	}
	x.allot(uint64(1)<<rp.Width, b, xb, r)
	return true
}
func (x *Table) Insert(r Route) bool {
	rp := r.RouteParams()
	return insert(x, rp.Width, x.sl, r)
}