From 8c3097004078cf72068097f42708711caec115e6 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sun, 7 Jun 2026 21:20:49 -0700 Subject: [PATCH] Fix treap priorities Docstring says "more priority", but `<` operator causes lesser priorities to sort to the top. --- data_structures/binary_tree/treap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_structures/binary_tree/treap.py b/data_structures/binary_tree/treap.py index 3114c6fa1c26..d404d2f38f34 100644 --- a/data_structures/binary_tree/treap.py +++ b/data_structures/binary_tree/treap.py @@ -65,7 +65,7 @@ def merge(left: Node | None, right: Node | None) -> Node | None: """ if (not left) or (not right): # If one node is None, return the other return left or right - elif left.prior < right.prior: + elif left.prior > right.prior: """ Left will be root because it has more priority Now we need to merge left's right son and right tree