Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
gaissmai committed Jan 27, 2023
1 parent bcb84aa commit dcc730e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions treap.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ func (n *node[T]) split(key T, immutable bool, t *Tree[T]) (left, mid, right *no
n = n.copyNode()
}

cmp := t.compare(n.item, key)
switch {
switch cmp := t.compare(n.item, key); {
case cmp < 0:
l, m, r := n.right.split(key, immutable, t)
n.right = l
Expand Down Expand Up @@ -288,8 +287,7 @@ func (t Tree[T]) Find(item T) (result T, ok bool) {
return
}

cmp := t.compare(item, n.item)
switch {
switch cmp := t.compare(item, n.item); {
case cmp == 0:
return n.item, true
case cmp < 0:
Expand Down Expand Up @@ -375,8 +373,7 @@ func (n *node[T]) lcp(item T, t *Tree[T]) (result T, ok bool) {
return
}

cmp := t.compare(n.item, item)
switch {
switch cmp := t.compare(n.item, item); {
case cmp > 0:
// left rec-descent
return n.left.lcp(item, t)
Expand Down

0 comments on commit dcc730e

Please sign in to comment.