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 b7008d3

Browse files
logging in searches
1 parent 0b91d15 commit b7008d3

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

‎competitivepython/searches/KMP_pattern_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def kmp_search(pat, txt):
3636
return indices
3737
except Exception as e:
3838
logging.exception("An error occurred during KMP search: %s", e)
39-
return []
39+
return "An error occurred during Knuth Morris Pratt search: {}".format(str(e))
4040

4141
def computeLPSArray(pat, M, lps):
4242
len = 0 # length of the previous longest prefix suffix

‎competitivepython/searches/binarysearch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ def binary_search(arr, target):
1414
return -1
1515
except Exception as e:
1616
logging.exception("An error occurred during binary search: %s", e)
17-
return -1
17+
return "An error occurred during binary search: {}".format(str(e))

‎competitivepython/searches/linearsearch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ def linear_search(arr, target):
88
return -1
99
except Exception as e:
1010
logging.exception("An error occurred during binary search: %s", e)
11-
return -1
11+
return "An error occurred during linear search: {}".format(str(e))
1212

0 commit comments

Comments
(0)

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