Commit Graph

1533 Commits

Author SHA1 Message Date
Christian Clauss
a9f73e318c
Added SkipList (#1781)
* Added SkipList

* Add missing type hints and doctests

* Add missing doctest

* Tighten up doctest

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-05 17:57:43 +01:00
matkosoric
7f04e5cd34
contribution guidelines checks (#1787)
* spelling corrections

* review

* improved documentation, removed redundant variables, added testing

* added type hint

* camel case to snake case

* spelling fix

* review

* python --> Python # it is a brand name, not a snake

* explicit cast to int

* spaces in int list

* "!= None" to "is not None"

* Update comb_sort.py

* various spelling corrections in documentation & several variables naming conventions fix

* + char in file name

* import dependency - bug fix

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-03-04 13:40:28 +01:00
Muhammad Umer Farooq
2b19e84767
Create emails_from_url.py (#1756)
* Create emails_from_url.py

* Update emails_from_url.py

* Update emails_from_url.py

* 0 emails found:

* Update emails_from_url.py

* Use Python set() to remove duplicates

* Update emails_from_url.py

* Add type hints and doctests

Co-authored-by: vinayak <itssvinayak@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-26 11:41:56 +01:00
praveennadiminti
c1a4cc96c8
Add bilateral filter (#1786)
* Added Bilateral filter

* Added Bilateral filter

* changed types of varS and varI

* formatted with black

* added type hints

* changed variable names

* Update bilateral_filter.py

* Drop transitory variables, add parse_args()

Co-authored-by: vinayak <itssvinayak@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-26 15:56:45 +05:30
singlav
5543d14b3f
estimate area under a curve defined by non-negative real-valued continuous function within a continuous interval using monte-carlo (#1785)
* estimate area under a curve defined by non-negative real-valued continuous function within a continuous interval using monte-carlo

* run black; update comments

* Use f”strings” and drop unnecessary returns

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-23 08:10:50 +01:00
Christian Clauss
652b891a75
Travis CI: Upgrade to Python 3.8 (#1783)
* Travis CI: Upgrade to Python 3.8

* updating DIRECTORY.md

* Tensorflow is not yet compatible with Python 3.8

* Disable k_means_clustering_tensorflow.py

* updating DIRECTORY.md

* Disable gan.py

* updating DIRECTORY.md

* Disable input_data.py

* updating DIRECTORY.md

* pip install a current version of six
2020-02-23 04:23:00 +01:00
singlav
b36e46b9b2
extend estimation of area under curve of y=x using monte carlo simulation to any given lower and upper bound (#1784)
* extend estimation of area under curve of y=x using monte carlo simulation to any given lower and upper bound

* remove doctest
2020-02-22 23:33:12 +01:00
singlav
6d7cbdacb1
add example to estimate area under line using montecarlo (#1782)
* add example to estimate area under line using montecarlo

* separate estimate func and print statements

* use mean from stats package

* avoid creating extra variable

* min_value: float=0.0, max_value: float=1.0

* Update montecarlo.py

* Update montecarlo.py

* Rename montecarlo.py to monte_carlo.py

* Update monte_carlo.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-22 19:06:47 +01:00
Christian Clauss
59bf115aa1
uses: actions/checkout@v2 (#1779)
* uses: actions/checkout@v2

* fixup! Format Python code with psf/black push
2020-02-21 15:32:35 +05:30
eightysixth
cb4795616c
Implemented geodesy - Lambert's ellipsoidal distance (#1763)
* Implemented Lambert's long line

* Update lamberts_ellipsoidal_distance.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-02-20 14:34:43 +01:00
Iqrar Agalosi Nureyza
6b3bbc70a8
Added doctests in modular_exponential.py (#1775)
* added doctests in modular_exponential.py

* added doctests in modular_exponential.py

* added URL link
2020-02-20 12:29:01 +01:00
TheSuperNoob
d2f7982a4e
Update quadratic equations solver (#1764)
Use pythons complex number module cmath for the calculation of the
roots
2020-02-20 00:15:55 +05:30
Naveen M V
748702b461
Add Monte Carlo dice simulation algorithm (#1759)
* Implement basic dice simulation

* Add tests to throw_dice

* Fix comment

* Add type hints

* Add additional comments

* Update monte_carlo_dice.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-17 10:55:04 +01:00
eightysixth
2e405f397b
Created geodesy section with one algorithm (#1757)
* implemented haversine

* updated docstring

Only calculate distance

* added type hints

* added type hints

* improved docstring and math usage

* f"{haversine_distance(*SAN_FRANCISCO, *YOSEMITE):0,.0f} meters"

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-16 10:55:27 +01:00
QuantumNovice
53042f0f45
Create RayleighQuotient.py (#1749)
* Create RayleighQuotient.py

https://en.wikipedia.org/wiki/Rayleigh_quotient

* Update RayleighQuotient.py

* Update and rename RayleighQuotient.py to rayleigh_quotient.py

* Update rayleigh_quotient.py

* Update rayleigh_quotient.py

python/black

* Update rayleigh_quotient.py
2020-02-14 12:56:56 +01: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
TheSuperNoob
f0dfc4f46d
Add Chudnovskys algorithm for calculating many digits of pi (#1752)
* Add Chudnovskys algorithm for calculating many digits of pi

* Update return value type hint

* Initialize partial sum to be of type Decimal

* Update chudnovsky_algorithm.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-12 15:04:59 +01:00
onlinejudge95
7b7c1a0135
Fixes unused variable errors in LGTM (#1746)
* Fixes unsed variable errors in LGTM

* Fixes integer check

* Fixes failing tests
2020-02-11 13:59:09 +05:30
billpaps
fde31c93a3
Added Bisection algorithm (#1739)
* Create Bisection.py

Find root of

* Update Bisection.py

* Update Bisection.py

i changed the given function with one that i could make the doctests.

* Rename Bisection.py to bisection.py

* Update bisection.py

* Update bisection.py

* Update bisection.py

* Update bisection.py

* Update bisection.py

Made the changes that were requested

* Update bisection.py

* Update bisection.py

* Add wiki url

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-11 09:20:24 +01:00
Jimmy Y
1096aa2336
Added DP Solution for Optimal BST Problem (#1740)
* Added code to dynamic_programming directory

* Added doctest

* Elaborated BST

* Small tweaks

* Update optimal_bst.py

* Some touchups

* Fixed doctest

* Update optimal_bst.py

* Update optimal_bst.py

* Update optimal_bst.py

* Rename optimal_bst.py to optimal_binary_search_tree.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-11 05:53:26 +01:00
ayoub-edh
abd320052f
Add gitpod config (#1744)
* Add gitpod config

* Add Gitpod to icon bar
2020-02-10 22:26:59 +01:00
onlinejudge95
6fdd53c676
Fixes LGTM issues (#1745)
* Fixes redefinition of a variable

* Fixes implementing __eq__

* Updates docstring
2020-02-10 22:23:19 +01:00
onlinejudge95
80718bd880 Fixes black failures (#1742) 2020-02-10 11:43:57 +01:00
MatteoRaso
32ceec550f
Added a Monte Carlo simulation (#1723)
* Added montecarlo.py

This algorithm uses a Monte Carlo simulation to estimate the value of pi.

* Rename montecarlo.py to maths/montecarlo.py

* Add files via upload

* Delete montecarlo.py

* Rename montecarlo.py to maths/montecarlo.py

* Update montecarlo.py
2020-02-09 02:17:11 +05:30
Christian Clauss
670f952aa6
Travis CI: Don’t allow bare exceptions (#1734)
* Travis CI: Don’t allow bare exceptions

* fixup! Format Python code with psf/black push

* except IOError:

* except IOError:

* Update hamming_code.py

* IndexError

* Get rid of the nonsense logic

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-02-07 22:02:08 +02:00
Miggelito
f52b97f2c5
Added Random Forest Regressor and tested with flake8 (#1733)
* Added Random Forest Regressor

* Updated file to standard
2020-02-08 00:07:14 +05:30
TheSuperNoob
1608d75351
Improve collatz_sequence algorithm (#1726)
- Add more doctests and type checking to make sure only natural
  numbers are used

- Simplified the algorithm slightly
	This new verison is also between 10-15% faster for really
	long sequences
2020-02-07 02:30:08 +05:30
Ale3androsS
e7041a8eca
Added first come first served scheduling (#1722)
* Added FCFS

* Fixed spelling error

* Rename fcfs.py to first_come_first_served.py

* Fixed FCFS and added tests.

* Made changes requested

* Use enumerate() instead of range(len())

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-06 21:48:58 +02:00
faizan2700
dacf1d0375
Implement Manacher's algorithm (#1721)
* manacher's algorithm updated
2020-02-05 19:27:42 +08:00
tania-cmyk
74a7b5f799
relevant documentation added (#1725) 2020-02-03 14:30:58 +05:30
cschuerc
81f077adfc Augment binary search algorithms (#1719) 2020-01-28 22:33:59 +05:30
Christian Clauss
bef74d0ecc Fix typo (#1718)
* Fix typo

* updating DIRECTORY.md
2020-01-28 05:09:47 +08:00
onlinejudge95
5c7d7782b0 Mandates referencing issue in PR (#1717)
* Mandates referencing issue in PR

* Update CONTRIBUTING.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update CONTRIBUTING.md

Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-27 21:54:57 +01:00
Faraz Ahmed Khan
63a1c4171a Added implementation for Bezier Curve, under a new graphics directory. (#1713)
* Added bezier curve

* black formatted

* corrected spell check

* edited scipy import

* updated documentation for readablitity

* Update bezier_curve.py

* Update bezier_curve.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-25 07:18:43 +01:00
Christian Clauss
46ac50a28e codespell --quiet-level=2 (#1711)
* codespell --quiet-level=2

Suppress the BINARY FILE warnings

* fixup! Format Python code with psf/black push
2020-01-24 00:21:51 +08:00
kostogls
2cf7e8f994 fix comment (#1710)
* fix comment

* Update armstrong_numbers.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-22 17:00:48 +01:00
kostogls
9a8e7de2df Adding Armstrong number (#1708)
* Adding Armstrong number

* Update armstrong_numbers

* Update armstrong_numbers.py

* Update armstrong_numbers.py

* Update armstrong_numbers.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-22 16:35:30 +01:00
Kyle
724b7d2198 Add Prim's algorithm with min heap (#1704) 2020-01-22 02:46:03 +08:00
Sharan Krishnan
3042702d04 Area Under a Curve Algorithm (#1701)
* A recursive insertion sort

* added doctests and typehints

* Added arc length and numerical integration calculators

* fixed doc test

* Fixed some conversion errors

* Fixed some commenting

* Deleted numerical integration to allow 1 file per push

* Changed string formatting method

* Added program to calculate trapezoidal area under curve

* Deleted files ensure 1 pull request per file

* file name changed

* Update area_under_curve.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-19 05:21:12 +01:00
Sharan Krishnan
e25d4248a3 Added an algorithm that approximates line lengths (#1692)
* A recursive insertion sort

* added doctests and typehints

* Added arc length and numerical integration calculators

* fixed doc test

* Fixed some conversion errors

* Fixed some commenting

* Deleted numerical integration to allow 1 file per push

* Changed string formatting method
2020-01-19 01:25:27 +08:00
Pooja
99ebd1a018 Create factorial_iterative.py (#1693)
* Create factorial_iterative.py

* Update factorial_iterative.py

* Update factorial_iterative.py

* Update factorial_iterative.py

* print(f"factorial{n} is {factorial(n)}")

* Update factorial_recursive.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-18 14:06:48 +01: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
Faraz Ahmed Khan
c01d178798 Added implementation for simulated annealing (#1679)
* added hill climbing algorithm

* Shorten long lines, streamline get_neighbors()

* Update hill_climbing.py

* Update and rename optimization/hill_climbing.py to searches/hill_climbing.py

* added hill climbing algorithm

* Shorten long lines, streamline get_neighbors()

* Update hill_climbing.py

* Rebased

* added simulated annealing.py

* added final comments and test

* black formatted

* restricted search domain

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-17 23:32:06 +01:00
Sombit Bose
c5b376d52d Solution for problem 30 of Euler Project (#1690)
* Create soln.py

Solution for problem 30 of Euler Project

* Update soln.py

* update soln.py

modified the changes

* if __name__ == "__main__":

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-16 15:19:02 +01:00
Cole Mollica
38bad6b1e8 Implemented Square Root Algorithm (#1687)
* Added to maths and strings

* added changes suggest by cclauss

* added square root function

* Fixed type hinting

* fixed type error

* Fixed another type error
2020-01-15 22:21:26 +01:00
lanzhiwang
fc4c0f5bfd implement max heap and more pythonic (#1685)
* implement max heap and more pythonic

* add doctests for heap
2020-01-14 12:16:11 +01:00
Logan Lieou
d09a805804 Typo? (#1653)
* Typo?

newNod -> newNode

* newNode -> new_node

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-01-14 10:21:02 +01:00
lanzhiwang
56e7ae01d2 enhance swapping code in link (#1660)
* enhance swapping code in link

* heapify do not recursive

* fix

* fix identifier and add test

* typing.Any and LinkedList instead of Linkedlist

* typing.Any and LinkedList instead of Linkedlist
2020-01-14 14:32:15 +05:30
Christian Clauss
b492e64417 Create pull_request_template.md (#1684)
* Create pull_request_template.md

* fixup! Format Python code with psf/black push

* Update pull_request_template.md

* updating DIRECTORY.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Typos and formatting

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-01-14 02:56:06 +08:00
shrabian
75523f9c1a A recursive insertion sort (#1683)
* A recursive insertion sort

* added doctests and typehints
2020-01-13 21:52:18 +05:30