improved swap (#974)
This commit is contained in:
parent
735748b359
commit
7d043cedb1
4
tree.go
4
tree.go
@ -105,9 +105,7 @@ func (n *node) incrementChildPrio(pos int) int {
|
|||||||
newPos := pos
|
newPos := pos
|
||||||
for newPos > 0 && n.children[newPos-1].priority < prio {
|
for newPos > 0 && n.children[newPos-1].priority < prio {
|
||||||
// swap node positions
|
// swap node positions
|
||||||
tmpN := n.children[newPos-1]
|
n.children[newPos-1], n.children[newPos] = n.children[newPos], n.children[newPos-1]
|
||||||
n.children[newPos-1] = n.children[newPos]
|
|
||||||
n.children[newPos] = tmpN
|
|
||||||
|
|
||||||
newPos--
|
newPos--
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user