mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort
* Fixed doctest error due whitespace
* reduce loop times for optimization
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@@ -25,7 +25,7 @@ class BoyerMooreSearch:
|
||||
self.textLen, self.patLen = len(text), len(pattern)
|
||||
|
||||
def match_in_pattern(self, char):
|
||||
""" finds the index of char in pattern in reverse order
|
||||
"""finds the index of char in pattern in reverse order
|
||||
|
||||
Parameters :
|
||||
char (chr): character to be searched
|
||||
|
||||
@@ -16,7 +16,7 @@ def capitalize(sentence: str) -> str:
|
||||
''
|
||||
"""
|
||||
if not sentence:
|
||||
return ''
|
||||
return ""
|
||||
lower_to_upper = {lc: uc for lc, uc in zip(ascii_lowercase, ascii_uppercase)}
|
||||
return lower_to_upper.get(sentence[0], sentence[0]) + sentence[1:]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user