Commit Graph

157 Commits

Author SHA1 Message Date
Du Yuanchao
a196a36514
Fixed bugs (#2474)
* fixed bug

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-25 15:20:09 +02:00
Du Yuanchao
3a275caf01
Fixed remove duplicate (#2470)
* fixed remove duplicate

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-24 19:14:52 +08:00
Du Yuanchao
902fe1c907
Fixed reverse words algorithm (#2469)
* updated reversed words

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-24 19:12:52 +08:00
Du Yuanchao
a1ea76bcf3
Optimization problem_10 in project_euler (#2453)
* optimization for problem09 in project_euler

* added benchmark code

* fixup! Format Python code with psf/black push

* Update project_euler/problem_09/sol1.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* updating DIRECTORY.md

* Update project_euler/problem_09/sol1.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-22 15:15:11 +02:00
Susmith98
9b73884def
Added a function that checks if given string can be rearranged to form a palindrome. (#2450)
* Added check_if_string_can_be_rearranged_as_palindrome function.

* Added counter implementation and benchmark function.

* flake changes

* Update and rename check_if_string_can_be_converted_to_palindrome.py to can_string_be_rearranged_as_palindrome.py

* Update can_string_be_rearranged_as_palindrome.py

* #

Co-authored-by: svedire <VedireSusmith_Reddy@intuit.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-19 21:49:37 +02:00
Christian Clauss
363858ef3b
hyphen_files = [file for file in filepaths if "-" in file] (#2447)
* hyphen_files = [file for file in filepaths if "-" in file]

* updating DIRECTORY.md

* Rename recursive-quick-sort.py to recursive_quick_sort.py

* updating DIRECTORY.md

* Rename aho-corasick.py to aho_corasick.py

* updating DIRECTORY.md

* Rename polynom-for-points.py to polynom_for_points.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-19 07:13:10 +02:00
Du Yuanchao
4d0a8f2355
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>
2020-09-10 10:31:26 +02:00
mohammadreza490
c38dec091f
capitalize (#2389)
* Create capitalize.py

This function will capitalize the first character of a sentence or a word

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update strings/capitalize.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update capitalize.py

* Update strings/capitalize.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update strings/capitalize.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update capitalize.py

* Update strings/capitalize.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update capitalize.py

* Update capitalize.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-03 16:11:23 +02:00
Du Yuanchao
0591968947
Optimization and fix bug (#2342)
* * optimization aliquot_sum
* fix bug in average_median

* fixup! Format Python code with psf/black push

* Update maths/average_median.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-21 14:39:03 +08:00
Kushagra Bansal
2eca71663b
Created check_anagrams.py in strings (#2339)
* Add files via upload

* Update check_anagrams.py

* Update check_anagrams.py

* Update check_anagrams.py

* Update check_anagrams.py

* “” or not

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-19 18:24:02 +02:00
Nika Losaberidze
671e570c35
Implement prefix function, knuth-morris-pratt another usage (#2099)
* Implement prefix function, knuth-morris-pratt another usage

* fixup! Format Python code with psf/black push

* Fix style

* updating DIRECTORY.md

* Update prefix_function.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-17 18:27:05 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Nika Losaberidze
8bb7b8f457
Fix syntax for flake8 passing (#2096)
* Fix syntax for flake8 passing

* fixup! Format Python code with psf/black push

* # fmt: off / # fmt: on

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-12 06:51:47 +02:00
Nika Losaberidze
2264244a34
Add Z-function algorithm implementation (#2067)
* Add Z-function algorithm implementation

* Spelling correction

* Reference url correction

* Add additional function as an example of z-function usage, change docstrings for functions

* Fix flake8 errors

* Update z_function.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-11 19:43:05 +02:00
mateuszz0000
3de6f010c3
Refactor remove duplicates to more pythonic (#2093)
* Refactor strings/remove_duplicate to more pythonic

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-11 06:13:40 +02:00
mateuszz0000
1a254465e3
Naive string doctests + typehints (#2054)
* Added doctests

* Added __main__

* Commit suggestion

* Undo changes to keep only doctests and typehints

* Reundo function name with params

* Update naive_string_search.py

* Update naive_string_search.py

* Update naive_string_search.py

* Update naive_string_search.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-01 15:40:40 +02:00
Christian Clauss
1e8fe8efcf
circular_linked_list: Add more len() tests (#2051)
* circular_linked_list: Add more len() tests

* fixup! Format Python code with psf/black push

* prepend()

* updating DIRECTORY.md

* Fix decrementation of self.length

* Add empty list tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-31 13:06:57 +05:30
mateuszz0000
3357768fc3
Jaro winkler (#2041)
* Added jaro_winkler first version

* Added doctests

* Fix flake warnings

* Refactor

* Fixes bug in jaro winkler implementation

* Commit suggestions

* Missing comming suggestions

* Remove unused math module

* Import doctest

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-05-31 00:14:55 +05:30
Ashwin Das
d8a4faf96d
Update is_palindrome.py (#2025)
* Update is_palindrome.py

* Update is_palindrome.py

* Reuse s

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-22 11:57:23 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
Arkadip Bhattacharya
098be3594b
fix: space count in strings/word_occurrence.py (#1896)
* fix: space count in strings/word_occurrence.py

* Update strings/word_occurrence.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update strings/word_occurrence.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update strings/word_occurrence.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update word_occurrence.py

Seems like, there is no need o `occurrence.pop('', None)`

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-04-21 17:28:54 +02:00
Muhammad Umer Farooq
4b78c6952d
Create is_palindrome.py (#1754)
* Create is_palindrome.py

* Update is_palindrome.py

* Update is_palindrome.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-04-19 22:05:36 +05:30
Joaquin Cabezas
c1a57e0353
Fix typo "panagram" -> "pangram" (#1836) 2020-04-07 14:08:11 +02:00
Christian Clauss
3d129a4964
Create Python/quantum/README.md (#1834)
* Create Python/quantum/README.md

Started at #1831

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-04-07 11:58:23 +02:00
farnswj1
20c2db0de4
Update reverse_words.py (#1825)
The following update results in less lines of code and faster performance while preserving functionality.
2020-04-04 07:01:37 +02:00
Nolan Emirot
9b376a5bfb
Typo in comment rabin_karp.py (#1820)
* Update rabin_karp.py

fix: typo

* Update rabin_karp.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-29 10:19:19 +02:00
onlinejudge95
4866b1330b
Fixes black failures from Previous PR (#1751)
* Fixes black failures from Previous PR

* Fixes equality testing alert

* Fixes call to main() alert

* Fixes unused import
2020-02-13 02:19:41 +05:30
faizan2700
dacf1d0375
Implement Manacher's algorithm (#1721)
* manacher's algorithm updated
2020-02-05 19:27:42 +08:00
Christian Clauss
bfcb95b297
Create codespell.yml (#1698)
* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
2020-01-18 13:24:33 +01:00
Cole Mollica
a26ae00b24 Added to maths and strings (#1642)
* Added to maths and strings

* added changes suggest by cclauss
2020-01-08 14:18:17 +01:00
Christian Clauss
28419cf839 pyupgrade --py37-plus **/*.py (#1654)
* pyupgrade --py37-plus **/*.py

* fixup! Format Python code with psf/black push
2020-01-03 22:25:36 +08:00
Sarath Kaul
2565797504 Reverse Words (#1581)
* Word Occurence Script Added

* Word Occurence Script Updated

* Added doctest using collections.Counter

https://docs.python.org/3/library/collections.html#collections.Counter

* Reverse Word Script Added

* Reverse Word Script Added

* Reverse Word Script Added

* Reverse Word Script Added

* Word Occurence Script Added

* Reverse Word Script Added

* Reverse Word Script Added

* Reverse Words DocTest Updated

* Word Occurence Updated

* Doctest Updated

* Doctest Updated

* Doctest Updated
2019-11-18 12:47:26 +01:00
Sarath Kaul
9a894ebc52 Word Occurence Script Added (#1576)
* Word Occurence Script Added

* Word Occurence Script Updated

* Added doctest using collections.Counter

https://docs.python.org/3/library/collections.html#collections.Counter
2019-11-17 12:57:26 +01:00
Sarath Kaul
e3f55aecce Remove Duplicate Script Added (#1570)
* Added Remove duplicate script and updated requirements.txt

* Requirements.txt Updated

* Remove Duplicate Script Added

* Directory Modified

* Directory.md Updated
2019-11-14 21:01:51 +01:00
Sarath Kaul
dd7d2fa270 Panagram Script Added (#1564)
* Python Program that fetches top trending news

* Python Program that fetches top trending news

* Revisions in Fetch BBC News

* psf/black Changes

* Python Program to send slack message to a channel

* Slack Message Revision Changes

* Python Program to check Palindrome String

* Doctest Added

* Python Program to check whether a String is Panagram or not

* Python Program to check whether a String is Panagram or not

* Check Panagram Script Added

* Panagram Script Added

* Anagram Script Changes

* Anagram Alphabet Check Added

* Python Program to fetch github info
2019-11-14 11:22:07 +01:00
Samarth Sehgal
3ea0992dc7 Update aho-corasick.py (#1457) 2019-10-25 19:05:23 +02:00
Aashay Shingre
92268561a5 Aho-Corasick String Matching Algorithm (#346)
* add aho-corasick algorithm

* Add a doctest and format with black
2019-10-22 09:42:56 +02:00
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
Denis Trofimov
04962c0d17 Fix lgtm error display #1024 (#1190)
* fix: Syntax Error lgtm display in matrix/matrix_operation.py.

* Testing for None should use the 'is' operator.

* fix: Too many arguments for string format.

* fix: supress lgtm alert as false positive.

* style: Unnecessary 'pass' statement.

* Revert "fix: Syntax Error lgtm display in matrix/matrix_operation.py."

This reverts commit 4c629b4ce1.
2019-09-21 16:23:34 +02:00
Christian Clauss
47a9ea2b0b
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python

* sort() --> sorted()
2019-08-19 15:37:49 +02:00
Hector S
4437439363 Added Unicode test to strings/rabin_karp.py (#1096)
* Added print function into matrix_multiplication_addition.py and removed blank space in data_structures/binary tree directory

* Removed .vs/ folder per #893

* Rename matrix_multiplication_addition.py to matrix_operation.py

* Unicode test on strings/rabin_karp.py per #1067
2019-08-05 07:07:52 +02:00
Md. Mahbubur Rahman
7c3ef98853 Implement ruling hash to appropriate complexity of Rabin Karp (#1066)
* Added matrix exponentiation approach for finding fibonacci number.

* Implemented the way of finding nth fibonacci.
* Complexity is about O(log(n)*8)

* Updated the matrix exponentiation approach of finding nth fibonacci.

- Removed some extra spaces    
- Added the complexity of bruteforce algorithm  
- Removed unused function called zerro()  
- Added some docktest based on request

* Updated the matrix exponentiation approach of finding nth fibonacci.

- Removed some extra spaces
- Added the complexity of bruteforce algorithm
- Removed unused function called zerro()
- Added some docktest based on request

* Updated Rabin Karp algorithm.

- Previous solution is based on the hash function of python.
- Implemented ruling hash to get the appropriate complexity of rabin karp.

* Updated Rabin Karp algorithm.

- Previous solution is based on the hash function of python.
- Implemented ruling hash to get the appropriate complexity of rabin karp.

*  Implemented ruling hash to appropriate complexity of Rabin Karp

Added unit pattern testing
2019-07-24 11:32:05 +02:00
Alfonso Rodríguez Pereira
5f991f7740 #315 Renamed all files to snake_case (#993) 2019-07-11 11:16:42 +02:00
Dharni0607
27a8184ccf add ons in string directory - Bayer_Moore_Search (#933) 2019-07-02 16:49:31 +04:30
Anup Kumar Panwar
71be23999c refactor 2019-05-26 21:56:10 +05:30
Erfan Alimohammadi
c4d16820bc
Fix typo (#806) 2019-05-14 21:45:53 +04:30
Reshad Hasan
e6e5f4b301 Added naive string search algorithm (#715) 2019-02-23 22:18:21 +08:00
Mickaël Schoentgen
2d70e9f747 Fix ResourceWarning: unclosed file (#681)
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
2019-01-08 16:59:23 +08:00
Jitendra_Sharma
f4806eb48c manacher's algorithm to find palindromic string (#676)
manacher's algorithm to find palindromic string in linear time complexity
2019-01-02 19:17:56 +08:00
Alex Brown
91fccecb56 snake_case all the things 2018-10-19 17:14:25 -05:00
ParthS007
0856a61859 Remove Multiple Unused Imports and Variable 2018-10-18 02:58:57 +05:30
Kelvin Salton do Prado
ae7660161c strings: add levenshtein distance metric 2018-10-02 21:11:30 -03:00
Daniel Ingram
0deb227705
Update min-cost-string-conversion.py 2018-03-20 18:50:55 -04:00
Daniel Ingram
6abab54c2b Minimum cost for transformation from one string to another using basic operations 2018-03-20 18:49:47 -04:00
Daniel Ingram
a753acf1de Computes minimum cost for converting one string into another 2018-03-20 15:23:09 -04:00
damelLP
0d36dc60c5 fixed failure function and cleaned up code in kmp + added rabin-karp 2018-01-07 12:49:51 +00:00
Damel
495fdc1ff9 Added a python implementation of knuth-morris-pratt string search algo 2017-11-11 15:19:41 +00:00