Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 901e709

Browse files
committed
CHORE Fixed typo in brute_force_search function
1 parent 37ac888 commit 901e709

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ def _rank(key: int, the_array: [int], min_index: int, max_index: int) -> int:
164164
# ---------------------------------------------------------------------------------------------------------
165165

166166

167-
def brute_fore_search(key: int, the_array: [int], index: int) -> int:
167+
def brute_force_search(key: int, the_array: [int], index: int) -> int:
168168
"""Returns the index of the key if present, otherwise -1 using brute force search"""
169169
if index == len(the_array):
170170
return -1
171171

172172
if the_array[index] == key:
173173
return index
174174

175-
return brute_fore_search(key, the_array, index + 1)
175+
return brute_force_search(key, the_array, index + 1)
176176

177177

178178
# ---------------------------------------------------------------------------------------------------------
@@ -255,7 +255,7 @@ def main():
255255

256256
print()
257257
print("- Brute Force Search: key = 8")
258-
print(f"index: { brute_fore_search(8, sorted(test_int_array), 0) }")
258+
print(f"index: { brute_force_search(8, sorted(test_int_array), 0) }")
259259

260260

261261
# ---------------------------------------------------------------------------------------------------------

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /