Skip to content

Commit 17edc1a

Browse files
authored
Merge branch 'master' into add-rotating-calipers
2 parents 4092a5f + 4a766c6 commit 17edc1a

3 files changed

Lines changed: 10 additions & 4 deletions

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

data_structures/stacks/balanced_parentheses.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ def balanced_parentheses(parentheses: str) -> bool:
1111
False
1212
>>> balanced_parentheses("1+2*3-4")
1313
True
14+
>>> balanced_parentheses("{}")
15+
True
16+
>>> balanced_parentheses("))((")
17+
False
18+
>>> balanced_parentheses("((")
19+
False
1420
>>> balanced_parentheses("")
1521
True
1622
"""

fuzzy_logic/fuzzy_operations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class FuzzySet:
5757
5858
# Union Operations
5959
>>> siya.union(sheru)
60-
FuzzySet(name='Siya U Sheru', left_boundary=0.4, peak=0.7, right_boundary=1.0)
60+
FuzzySet(name='Siya U Sheru', left_boundary=0.4, peak=1.0, right_boundary=0.7)
6161
"""
6262

6363
name: str
@@ -147,13 +147,13 @@ def union(self, other) -> FuzzySet:
147147
FuzzySet: A new fuzzy set representing the union.
148148
149149
>>> FuzzySet("a", 0.1, 0.2, 0.3).union(FuzzySet("b", 0.4, 0.5, 0.6))
150-
FuzzySet(name='a U b', left_boundary=0.1, peak=0.6, right_boundary=0.35)
150+
FuzzySet(name='a U b', left_boundary=0.1, peak=0.35, right_boundary=0.6)
151151
"""
152152
return FuzzySet(
153153
f"{self.name} U {other.name}",
154154
min(self.left_boundary, other.left_boundary),
155-
max(self.right_boundary, other.right_boundary),
156155
(self.peak + other.peak) / 2,
156+
max(self.right_boundary, other.right_boundary),
157157
)
158158

159159
def plot(self):

0 commit comments

Comments
 (0)