Commit Graph

3401 Commits

Author SHA1 Message Date
Tianyi Zheng
e887c14f12
Fix continued_fraction.py to work for negative numbers (#8985)
* Add doctests to continued_fraction.py for 0 and neg nums

* Fix continued_fraction.py to work for negative nums

Fix continued_fraction.py to work for negative nums by replacing int() call with floor()

* Move comment in doctest
2023-08-18 16:53:17 -04:00
Caeden Perelli-Harris
945803f65d
Unmark fetch anime and play as BROKEN and fix type errors (#8988)
* updating DIRECTORY.md

* type(fetch-anime-and-play): Fix type errors and re-enable

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-18 05:19:25 -07:00
Caeden Perelli-Harris
5f7819e1cd
Fix get top billionaires BROKEN file (#8970)
* updating DIRECTORY.md

* fix(get-top-billionaires): Handle timestamp before epoch

* updating DIRECTORY.md

* revert(pyproject): Re-implement ignore lru_cache

* fix(age): Update age to current year

* fix(doctest): Make years since dynamic

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-18 05:13:38 -07:00
Boris Galochkin
72c7b05caa
Fix sorts/bucket_sort.py implementation (#5786)
* Fix sorts/bucket_sort.py

* updating DIRECTORY.md

* Remove unused var in bucket_sort.py

* Fix list index in bucket_sort.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-17 18:38:19 -07:00
Ilkin Mengusoglu
a207187ddb
Fix simplex.py (#8843)
* changes to accommodate special case

* changed n_slack calculation method

* fix precommit typehints

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* n_art_vars inputs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: docstrings and typehints

* fix: doctest issues when running code

* additional check and doctests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix ruff

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix whitespace

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-17 14:34:53 -07:00
Kausthub Kannan
f6b12420ce
Added Leaky ReLU Activation Function (#8962)
* Added Leaky ReLU activation function

* Added Leaky ReLU activation function

* Added Leaky ReLU activation function

* Formatting and spelling fixes done
2023-08-16 18:22:15 -07:00
Caeden Perelli-Harris
fd7cc4cf8e
Rename norgate to nor_gate to keep consistency (#8968)
* refactor(boolean-algebra): Rename norgate to nor_gate

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-16 18:21:00 -07:00
Tianyi Zheng
beb43517c3
Fix mypy errors in maths/gaussian_error_linear_unit.py (#8610)
* updating DIRECTORY.md

* Fix mypy errors in gaussian_error_linear_unit.py

* updating DIRECTORY.md

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-16 07:36:10 -04:00
homsim
5c276a8377
Quick fix: fig.canvas.set_window_title deprecated (#8961)
Co-authored-by: homsim <simon@simon-ThinkPadE460.fritz.box>
2023-08-16 01:07:50 -07:00
Saksham1970
bfed2fb788
Added Continued fractions (#6846)
* updating DIRECTORY.md

* added continued fractions

* updating DIRECTORY.md

* Update maths/continued_fraction.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update maths/continued_fraction.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-16 00:24:12 -07:00
Maxim Smolskiy
f66568e981
Reduce the complexity of boolean_algebra/quine_mc_cluskey.py (#8604)
* Reduce the complexity of boolean_algebra/quine_mc_cluskey.py

* updating DIRECTORY.md

* Fix

* Fix review issues

* Fix

* Fix review issues

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-15 16:10:22 -07:00
isidroas
efaf526737
BST and RSA doctest (#8693)
* rsa key doctest

* move doctest to module docstring

* all tests to doctest

* moved is_right to property

* is right test

* fixed rsa doctest import

* Test error when deleting non-existing element

* fixing ruff EM102

* convert property 'is_right' to one-liner

Also use 'is' instead of '=='

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* child instead of children

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* remove type hint

* Update data_structures/binary_tree/binary_search_tree.py

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-15 16:04:53 -07:00
Juyoung Kim
cecf1fdd52
Fix greedy_best_first (#8775)
* fix: typo
#8770

* refactor: delete unnecessary continue

* add test grids

* fix: add \_\_eq\_\_ in Node class
#8770

* fix: delete unnecessary code
- node in self.open_nodes is always better node
#8770

* fix: docstring

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: docstring max length

* refactor: get the successors using a list comprehension

* Apply suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-15 15:52:51 -07:00
Caeden Perelli-Harris
490e645ed3
Fix minor typing errors in maths/ (#8959)
* updating DIRECTORY.md

* types(maths): Fix pylance issues in maths

* reset(vsc): Reset settings changes

* Update maths/jaccard_similarity.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* revert(erosion_operation): Revert erosion_operation

* test(jaccard_similarity): Add doctest to test alternative_union

* types(newton_raphson): Add typehints to func bodies

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-15 14:27:41 -07:00
Erfan Alimohammadi
7618a92fee
Remove a slash in path to save the file correctly on Linux (#8053) 2023-08-15 16:37:49 -04:00
pre-commit-ci[bot]
7021afda04
[pre-commit.ci] pre-commit autoupdate (#8963)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.282 → v0.0.284](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.282...v0.0.284)
- [github.com/tox-dev/pyproject-fmt: 0.13.0 → 0.13.1](https://github.com/tox-dev/pyproject-fmt/compare/0.13.0...0.13.1)
- [github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.5.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.4.1...v1.5.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-14 23:12:11 -04:00
Caeden Perelli-Harris
fb1b939a89
Consolidate find_min and find_min recursive and find_max and find_max_recursive (#8960)
* updating DIRECTORY.md

* refactor(min-max): Consolidate implementations

* updating DIRECTORY.md

* refactor(min-max): Append _iterative to func name

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-14 04:17:27 -07:00
robertjcalistri
2ab3bf2689
Added functions to calculate temperature of an ideal gas and number o… (#8919)
* Added functions to calculate temperature of an ideal gas and number of moles of an ideal gas

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update physics/ideal_gas_law.py

Renamed function name

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update physics/ideal_gas_law.py

Updated formatting

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update physics/ideal_gas_law.py

Removed unnecessary parentheses

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update physics/ideal_gas_law.py

Removed unnecessary parentheses

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update ideal_gas_law.py

Updated incorrect function calls moles of gas system doctests

* Update physics/ideal_gas_law.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-14 02:31:53 -07:00
Adithya Awati
ac68dc1128
Fixed Pytest warnings for machine_learning/forecasting (#8958)
* updating DIRECTORY.md

* Fixed pyTest Warnings

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-14 01:34:16 -07:00
Caeden Perelli-Harris
4b7ecb6a81
Create is valid email address algorithm (#8907)
* feat(strings): Create is valid email address

* updating DIRECTORY.md

* feat(strings): Create is_valid_email_address algorithm

* chore(is_valid_email_address): Implement changes from code review

* Update strings/is_valid_email_address.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* chore(is_valid_email_address): Fix ruff error

* Update strings/is_valid_email_address.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-14 01:28:52 -07:00
Adithya Awati
c290dd6a43
Update run.py in machine_learning/forecasting (#8957)
* Fixed reading CSV file, added type check for data_safety_checker function

* Formatted run.py

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-14 00:16:24 -07:00
Ajinkya Chikhale
02d89bde67
Added implementation for Tribonacci sequence using dp (#6356)
* Added implementation for Tribonacci sequence using dp

* Updated parameter name

* Apply suggestions from code review

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-14 00:12:42 -07:00
Amir Hosseini
f24ab2c60d
Add: Two Regex match algorithm (Recursive & DP) (#6321)
* Add recursive solution to regex_match.py

* Add dp solution to regex_match.py

* Add link to regex_match.py

* Minor edit

* Minor change

* Minor change

* Update dynamic_programming/regex_match.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update dynamic_programming/regex_match.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Fix ruff formatting in if statements

* Update dynamic_programming/regex_match.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-13 22:37:41 -07:00
Caeden Perelli-Harris
9d86d4edaa
Create wa-tor algorithm (#8899)
* feat(cellular_automata): Create wa-tor algorithm

* updating DIRECTORY.md

* chore(quality): Implement algo-keeper bot changes

* Update cellular_automata/wa_tor.py

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

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor(repr): Return repr as python object

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update cellular_automata/wa_tor.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* refactor(display): Rename to display_visually to visualise

* refactor(wa-tor): Use double for loop

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* chore(wa-tor): Implement suggestions from code review

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-13 17:58:17 -07:00
Maxim Smolskiy
4f2a346c27
Reduce the complexity of linear_algebra/src/polynom_for_points.py (#8605)
* Reduce the complexity of linear_algebra/src/polynom_for_points.py

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix

* Fix review issues

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-13 03:05:42 -07:00
Suman
c39b7eadbd
updated the URL and HTML tags for scrapping yahoo finance (#8942)
* updated the url and tags for yahoo finance

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated to return the error text

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-12 14:58:37 -07:00
Tianyi Zheng
ae0fc85401
Fix ruff errors (#8936)
* Fix ruff errors

Renamed neural_network/input_data.py to neural_network/input_data.py_tf
because it should be left out of the directory for the following
reasons:

1. Its sole purpose is to be used by neural_network/gan.py_tf, which is
   itself left out of the directory because of issues with TensorFlow.

2. It was taken directly from TensorFlow's codebase and is actually
   already deprecated. If/when neural_network/gan.py_tf is eventually
   re-added back to the directory, its implementation should be changed
   to not use neural_network/input_data.py anyway.

* updating DIRECTORY.md

* Change input_data.py_tf file extension

Change input_data.py_tf file extension because algorithms-keeper bot is being picky about it

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-09 13:25:30 +05:30
AmirSoroush
842d03fb2a
improvements to jump_search.py (#8932)
* improvements to jump_search.py

* add more tests to jump_search.py
2023-08-08 14:47:09 -07:00
pre-commit-ci[bot]
ac62cdb94f
[pre-commit.ci] pre-commit autoupdate (#8930)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.281 → v0.0.282](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.281...v0.0.282)

* updating DIRECTORY.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-07 19:52:39 -04:00
Dipankar Mitra
db6bd4b17f
IQR function is added (#8851)
* tanh function been added

* tanh function been added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* tanh function is added

* tanh function is added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* tanh function added

* tanh function added

* tanh function is added

* Apply suggestions from code review

* ELU activation function is added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* elu activation is added

* ELU activation is added

* Update maths/elu_activation.py

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

* Exponential_linear_unit activation is added

* Exponential_linear_unit activation is added

* SiLU activation is added

* SiLU activation is added

* mish added

* mish activation is added

* inter_quartile_range function is added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Mish activation function is added

* Mish action is added

* mish activation added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* mish activation added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* inter quartile range (IQR) function is added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* IQR function is added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* code optimized in IQR function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* interquartile_range function is added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maths/interquartile_range.py

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

* Changes on interquartile_range

* numpy removed from interquartile_range

* Fixes from code review

* Update interquartile_range.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-08-07 07:47:42 -04:00
AmirSoroush
ce218c57f1
fixes #8673; Add operator's associativity check for stacks/infix_to_p… (#8674)
* fixes #8673; Add operator's associativity check for stacks/infix_to_postfix_conversion.py

* fix ruff N806 in stacks/infix_to_postfix_conversion.py

* Update data_structures/stacks/infix_to_postfix_conversion.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update data_structures/stacks/infix_to_postfix_conversion.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-01 11:23:34 -07:00
pre-commit-ci[bot]
c9a7234a95
[pre-commit.ci] pre-commit autoupdate (#8914)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.280 → v0.0.281](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.280...v0.0.281)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-01 09:26:23 +05:30
Jan Wojciechowski
f7c5e55609
Window closing fix (#8625)
* The window will now remain open after the fractal is finished being drawn, and will only close upon your click.

* Update fractals/sierpinski_triangle.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-31 20:02:49 -07:00
Minha, Jeong
f8fe72dc37
Update game_of_life.py (#4921)
* Update game_of_life.py

docstring error fix
delete no reason delete next_gen_canvas code(local variable)

* Update cellular_automata/game_of_life.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-31 14:24:12 -07:00
Tianyi Zheng
5cf34d901e
Ruff fixes (#8913)
* updating DIRECTORY.md

* Fix ruff error in eulerian_path_and_circuit_for_undirected_graph.py

* Fix ruff error in newtons_second_law_of_motion.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-07-31 13:53:26 -07:00
Dylan Buchi
90a8e6e0d2
Update sorts/bubble_sort.py (#5802)
* Add missing type annotations in bubble_sort.py

* Refactor bubble_sort function
2023-07-31 11:50:00 -07:00
roger-sato
0b0214c42f
Handle empty input case in Segment Tree build process (#8718) 2023-07-31 11:46:30 -07:00
Tianyi Zheng
629eb86ce0
Fix merge conflicts to merge change from #5080 (#8911)
* Input for user choose his Collatz sequence

Now the user can tell the algorithm what number he wants to run on the Collatz Sequence.

* updating DIRECTORY.md

---------

Co-authored-by: Hugo Folloni <hugofollogua07@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-07-31 07:23:23 +02:00
AmirSoroush
384c407a26
Enhance the implementation of Queue using list (#8608)
* enhance the implementation of queue using list

* enhance readability of queue_on_list.py

* rename 'queue_on_list' to 'queue_by_list' to match the class name
2023-07-30 19:07:35 -07:00
Almas Bekbayev
8cce9cf066
Fix linear_search docstring return value (#8644) 2023-07-30 18:32:05 -07:00
David Leal
4710e51deb
chore: use newest Discord invite link (#8696)
* updating DIRECTORY.md

* chore: use newest Discord invite link

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-07-30 18:15:30 -07:00
AmirSoroush
d4f2873e39
add reverse_inorder traversal to binary_tree_traversals.py (#8726)
* add reverse_inorder traversal to binary_tree_traversals.py

* Apply suggestions from code review

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-07-30 17:54:15 -07:00
Bazif Rasool
8b831cb600
Added Altitude Pressure equation (#8909)
* Added Altitude Pressure equation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Removed trailing whitespaces

* Removed pylint

* Fix lru_cache_pythonic.py

* Fixed spellings

* Fix again lru_cache_pythonic.py

* Update .vscode/settings.json

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

* Third fix lru_cache_pythonic.py

* Update .vscode/settings.json

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

* 4th fix lru_cache_pythonic.py

* Update physics/altitude_pressure.py

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

* lru_cache_pythonic.py: def get(self, key: Any, /) -> Any | None:

* Delete lru_cache_pythonic.py

* Added positive and negative pressure test cases

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-07-30 17:00:58 +02:00
Yatharth Mathur
d31750adec
Pythonic implementation of LRU Cache (#4630)
* Added a more pythonic implementation of LRU_Cache.[#4628]

* Added test cases and doctest

* Fixed doc tests

* Added more tests in doctests and fixed return types fixes [#4628]

* better doctests

* added doctests to main()

* Added dutch_national_flag.py in sorts. fixing [#4636]

* Delete dutch_national_flag.py

incorrect commit

* Update lru_cache_pythonic.py

* Remove pontification

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-07-30 11:27:45 +02:00
Colin Leroy-Mira
2cfef0913a
Fix greyscale computation and inverted coords (#8905)
* Fix greyscale computation and inverted coords

* Fix test

* Add test cases

* Add reference to the greyscaling formula

---------

Co-authored-by: Colin Leroy-Mira <colin.leroy-mira@sigfox.com>
2023-07-29 10:03:43 -07:00
Tianyi Zheng
0ef9306976
Disable quantum/quantum_random.py (attempt 2) (#8902)
* Disable quantum/quantum_random.py

Temporarily disable quantum/quantum_random.py because it produces an illegal instruction error that causes all builds to fail

* updating DIRECTORY.md

* Disable quantum/quantum_random.py attempt 2

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-07-28 22:08:40 +02:00
Alex Bernhardt
a0b642cfe5
Physics/basic orbital capture (#8857)
* Added file basic_orbital_capture

* updating DIRECTORY.md

* added second source

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed spelling errors

* accepted changes

* updating DIRECTORY.md

* corrected spelling error

* Added file basic_orbital_capture

* added second source

* fixed spelling errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* applied changes

* reviewed and checked file

* added doctest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* removed redundant constnant

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added scipy imports

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added doctests to capture_radii and scipy const

* fixed conflicts

* finalizing file. Added tests

* Update physics/basic_orbital_capture.py

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-07-28 20:30:05 +02:00
Tianyi Zheng
e406801f9e
Reimplement polynomial_regression.py (#8889)
* Reimplement polynomial_regression.py

Rename machine_learning/polymonial_regression.py to
machine_learning/polynomial_regression.py

Reimplement machine_learning/polynomial_regression.py using numpy
because the old original implementation was just a how-to on doing
polynomial regression using sklearn

Add detailed function documentation, doctests, and algorithm
explanation

* updating DIRECTORY.md

* Fix matrix formatting in docstrings

* Try to fix failing doctest

* Debugging failing doctest

* Fix failing doctest attempt 2

* Remove unnecessary return value descriptions in docstrings

* Readd placeholder doctest for main function

* Fix typo in algorithm description

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-07-28 20:17:46 +02:00
Caeden Perelli-Harris
4a83e3f0b1
Fix failing build due to missing requirement (#8900)
* feat(cellular_automata): Create wa-tor algorithm

* updating DIRECTORY.md

* chore(quality): Implement algo-keeper bot changes

* build: Fix broken ci

* git rm cellular_automata/wa_tor.py

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-07-28 20:12:31 +02:00
Christian Clauss
46454e204c
[skip-ci] In .devcontainer/Dockerfile: pipx install pre-commit ruff (#8893)
[skip-ci] In .devcontainer/Dockerfile: pipx install pre-commit ruff
2023-07-28 18:54:45 +02:00