Skip to content

Commit 167b255

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 0d65561 commit 167b255

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

searches/ternary_search.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ def ternary_search_recursive(
103103
elif target > array[two_third]:
104104
return ternary_search_recursive(array, target, two_third + 1, right, threshold)
105105
else:
106-
return ternary_search_recursive(array, target, one_third + 1, two_third - 1, threshold)
106+
return ternary_search_recursive(
107+
array, target, one_third + 1, two_third - 1, threshold
108+
)
107109

108110

109111
if __name__ == "__main__":
@@ -114,7 +116,9 @@ def ternary_search_recursive(
114116
try:
115117
raw_input = input("\nEnter sorted numbers separated by commas: ").strip()
116118
collection = [int(x) for x in raw_input.split(",")]
117-
assert collection == sorted(collection), "Input must be sorted in ascending order."
119+
assert collection == sorted(collection), (
120+
"Input must be sorted in ascending order."
121+
)
118122
target = int(input("Enter the number to search: "))
119123

120124
result_iter = ternary_search_iterative(collection, target)

0 commit comments

Comments
 (0)