codezonediitj / pydatastructs

A python package for data structures and algorithms
https://pydatastructs.readthedocs.io/en/stable/
Other
202 stars 270 forks source link

Added Rabin–Karp algorithm #413

Closed pratikgl closed 3 years ago

pratikgl commented 3 years ago

Added Rabin–Karp algorithm to find API

References to other Issues or PRs or Relevant literature

Fixes #402

Brief description of what is fixed or changed

In the find API implemented in the string algorithm. I have added Rabin–Karp algorithm which finds the occurrence of a query string in a text using string hashing.

Other comments

Reference: https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm

codecov[bot] commented 3 years ago

Codecov Report

Merging #413 (823fc7b) into master (5cf53a2) will increase coverage by 0.013%. The diff coverage is 100.000%.

:exclamation: Current head 823fc7b differs from pull request most recent head 98209e4. Consider uploading reports for the commit 98209e4 to get more accurate results

@@              Coverage Diff              @@
##            master      #413       +/-   ##
=============================================
+ Coverage   98.622%   98.635%   +0.013%     
=============================================
Files           26        26               
Lines         3411      3444       +33     
=============================================
+ Hits          3364      3397       +33     
Misses          47        47               
Impacted Files Coverage Δ
pydatastructs/strings/algorithms.py 100.000% <100.000%> (ø)

Impacted file tree graph

pratikgl commented 3 years ago

Changes added:

  1. Added _p_pow function to decrease redundancy in the code
  2. Defined global variables PRIME_NUMBER, MOD
czgdp1807 commented 3 years ago

Thanks @pratikgl