Commit Graph

1505 Commits

Author SHA1 Message Date
hackercyclops12
1b65309dca
Update README.md (#1842) 2020-04-07 23:56:21 +02:00
Joan Martin Miralles
a38e143cf8
Binary search tree using recursion (#1839)
* Binary search tree using recursion

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-04-07 18:09:05 +02:00
Joaquin Cabezas
c1a57e0353
Fix typo "panagram" -> "pangram" (#1836) 2020-04-07 14:08:11 +02:00
Brian Larsen
e5f7fbcc9e
Change gitpod configuration for python3. (#1827) 2020-04-07 12:20:08 +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
Prince Gangurde
f35484baf6
Update greedy.py (#1832) 2020-04-07 01:00:10 +02:00
Prince Gangurde
6043a44ffb
Update basic_binary_tree.py (#1833)
fixed some grammar mistakes
2020-04-07 00:59:32 +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
Christian Clauss
f17e9822b0
psf/black changes to next_greater_element.py (#1817)
* psf/black changes to next_greater_element.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-28 07:24:59 +01:00
Vaibhav Singh
96df906e7a
All suggeted changes within additional time limit tests (#1815)
* With all suggested changes  

possibly covered all the recommended guidelines

* Updated with both slow and faster algorithms

possibally covered all the recomendations

* removed the time comparision part!

* Update data_structures/stacks/next_greater_element.py

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

* Update data_structures/stacks/next_greater_element.py

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

* Update data_structures/stacks/next_greater_element.py

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

* Update data_structures/stacks/next_greater_element.py

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

* Add benchmark using timeit

https://docs.python.org/3/library/timeit.html

The performance delta between these two implementation is quite small...
```
next_greatest_element_slow(): 1.843442126
     next_greatest_element(): 1.828941414
```

* Optimize slow() to create fast() - Three algorithms in the race

Three algorithms in the race

* Use a bigger test array with floats, negatives, zero

* Setup import next_greatest_element_fast

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-27 08:16:07 +01:00
wind-Lv
ac664df6a0
'allocation_content_length' (#1808)
* 'allocation_content_length'

* 'allocation_number'

* Delete allocation_content_length.py

* Update allocation_number.py

* Update allocation_number.py

* number_of_bytes and partitions

* Update allocation_number.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-20 15:24:05 +01:00
KDH
45524dd6d3
Fix rehashing function will not call insert_data function (#1803)
* Fix rehashing function will not call insert_data function

* Fix typo

* Update loop syntax instead of allocating a list

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-16 11:19:13 +01:00
Christian Clauss
ab3400bfad
Travis CI: Fix Travis linter errors (#1802)
* Travis CI: Fix Travis linter errors

* fixup! Format Python code with psf/black push

* Update .travis.yml

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-14 23:55:13 +01:00
cschuerc
1bc84e1fa0
Add Monte Carlo estimation of PI (#1712)
* Add Monte Carlo estimation of PI

* Add type annotations for Monte Carlo estimation of PI

* Compare the PI estimate to PI from the math lib

* accuracy -> error

* Update pi_monte_carlo_estimation.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-03-14 07:51:30 +01:00
Christian Clauss
d547d0347b
directory_writer: actions/checkout@v1 # Use v1, NOT v2 (#1799)
* directory_writer: actions/checkout@v1 # Use v1, NOT v2 (#1796

* updating DIRECTORY.md
2020-03-14 07:33:14 +01:00
John Law
2da98db4a7
Effective directory writer (#1800)
* updating DIRECTORY.md

* Update directory_writer.yml

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-14 06:37:44 +01:00
KDH
cb5f8c6e4e
Fix typo (#1797)
colision => collision
2020-03-13 13:46:52 +01:00
Christian Clauss
b1377f0e57
autoblack: actions/checkout@v1 # Use v1, NOT v2 (#1796)
* autoblack: actions/checkout@v1  # Use v1, NOT v2

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-13 09:23:38 +01:00
Miggelito
10fc90c7bd
Added Random Forest Classifier (#1738)
* Added Random Forest Regressor

* Updated file to standard

* Added Random Forest Classifier (Iris dataset) and a Confusion Matrix for result visualization
2020-03-13 09:13:43 +01:00
yoshitaka-i
5e3eb12a7b
add relu function (#1795) 2020-03-13 08:33:36 +01:00
Aakash Dinkar
182e3042f8
update rot13.py (#1790)
* update rot13.py

* Update rot13.py

* Type hints, doctests, URL to Wikipedia

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-08 07:04:21 +01:00
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