Commit f20ea980 authored by nikandfor's avatar nikandfor

element inserting fix at overflow func

parent 496c710a
......@@ -9,3 +9,4 @@
Brian Fallik <bfallik@gmail.com>
Dan Kortschak <dan.kortschak@adelaide.edu.au>
Jan Mercl <0xjnml@gmail.com>
Nikifor Seryakov <nikandfor@gmail.com>
......@@ -450,18 +450,13 @@ func (t *Tree) overflow(p *x, q *d, pi, i int, k interface{} /*K*/, v interface{
t.ver++
l, r := p.siblings(pi)
if l != nil && l.c < 2*kd {
if i > 0 {
if l != nil && l.c < 2*kd && i != 0 {
l.mvL(q, 1)
t.insert(q, i-1, k, v)
p.x[pi-1].k = q.d[0].k
return
}
t.insert(l, l.c, k, v)
return
}
if r != nil && r.c < 2*kd {
if i < 2*kd {
q.mvR(r, 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment