Skip to content

Commit 8c30970

Browse files
committed
Fix treap priorities
Docstring says "more priority", but `<` operator causes lesser priorities to sort to the top.
1 parent 6c04620 commit 8c30970

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

data_structures/binary_tree/treap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def merge(left: Node | None, right: Node | None) -> Node | None:
6565
"""
6666
if (not left) or (not right): # If one node is None, return the other
6767
return left or right
68-
elif left.prior < right.prior:
68+
elif left.prior > right.prior:
6969
"""
7070
Left will be root because it has more priority
7171
Now we need to merge left's right son and right tree

0 commit comments

Comments
 (0)