* Added Viterbi algorithm Fixes: #7465
Squashed commits
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added doctest for validators
* moved all extracted functions to the main function
* Forgot a type hint
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add files via upload
* Delete permutations.cpython-310.pyc
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update permutations.py
* Update permutations.py
* Add files via upload
* Delete permutations.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update permutations.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update permutations.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update permutations.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update data_structures/arrays/permutations.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update permutations.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update permutations.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update data_structures/arrays/permutations.py
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* Update permutations.py
* Update permutations.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update permutations.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>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* Create recursive_approach_knapsack.py
Added a new naïve recursive approach to solve the knapsack problem.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update recursive_approach_knapsack.py
Updated the code
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update recursive_approach_knapsack.py
Updated
* [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>
* Update password_generator.py
1. Use secrets module instead of random for passwords as it gives a secure source of randomness
2. Add type annotations for functions
3. Replace ctbi (variable for the characters to be included) with a more meaningful and short name
4. Use integer division instead of obtaining the integer part of a division computing a floating point
* [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>
* Create centripetal_force.py
Centripetal force is the force acting on an object in curvilinear motion directed towards the axis of rotation or centre of curvature.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update centripetal_force.py
The value error should also handle negative values of the radius and using more descriptive names will be more beneficial for the users
* Update centripetal_force.py
Made some bug fixes
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: SparshRastogi <75373475+SparshRastogi@users.noreply.github.com>
* Create potential_energy.py
Finding the gravitational potential energy of an object with reference to the earth, by taking its mass and height above the ground as input
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update physics/potential_energy.py
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* Update physics/potential_energy.py
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* Update physics/potential_energy.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Update physics/potential_energy.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Update physics/potential_energy.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Update physics/potential_energy.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Update physics/potential_energy.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* [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: Chris O <46587501+ChrisO345@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Cleanup the BFS
* Add both functions and timeit
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add performace results as comment
* Update breadth_first_search_2.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>
* Create combination_sum_iv.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update dynamic_programming/combination_sum_iv.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Update dynamic_programming/combination_sum_iv.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Update dynamic_programming/combination_sum_iv.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update combination_sum_iv.py
* Update combination_sum_iv.py
* Resolved PR Comments
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* minor change, argument missing in function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update dynamic_programming/combination_sum_iv.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* minor change
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update maximum_subarray.py
1. Rectify documentation to indicate the correct output: function doesn't return the subarray, but rather returns a sum.
2. Make the function more Pythonic and optimal.
3. Make function annotation generic i.e. can accept any sequence.
4. Raise value error when the input sequence is empty.
* Update maximum_subarray.py
1. Use the conventions as mentioned in pep-0257.
2. Use negative infinity as the initial value for the current maximum and the answer.
* Update maximum_subarray.py
Avoid type conflict by returning the answer cast to an integer.
* Update other/maximum_subarray.py
Co-authored-by: Andrey <Cjkjvfnby@gmail.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update maximum_subarray.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update maximum_subarray.py
Remove typecast to int for the final answer
Co-authored-by: Andrey <Cjkjvfnby@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Create fetch_amazon_product_data.py
This file provides a function which will take
a product name as input from the user,and fetch the necessary
information about that kind of products from Amazon like the product
title,link to that product,price of the product,the ratings of
the product and the discount available on the product
in the form of a csv file,this will help the users by improving searchability
and navigability and find the right product easily and in a short period of time,
it will also be beneficial for performing better analysis on products
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update fetch_amazon_product_data.py
Added type hints and modified files to pass precommit test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update fetch_amazon_product_data.py
Added type hints and made changes to pass the precommit
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update fetch_amazon_product_data.py
Modified function to return the data in the form of Pandas Dataframe,modified type hints and added a functionality to let the user determine if they need the data in a csv file
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update fetch_amazon_product_data.py
Made some bug fixes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update and rename fetch_amazon_product_data.py to get_amazon_product_data.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update get_amazon_product_data.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>
* Implemented Swish Function
* Added more description and return hint in def
* Changed the name and added more descrition including test for sigmoid function
* Added * in front of links
* Adopt Python >= 3.8 assignment expressions using auto-walrus
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
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>
* feat: Implement binary tree path sum (#7135)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update data_structures/binary_tree/binary_tree_path_sum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* refactor: Rename `dfs` to `depth_first_search`
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Refactoring the syntax using list comprehension
* Update detecting_english_programmatically.py
* Update detecting_english_programmatically.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Remove unnecessary else statement
* [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>
* Spheres union
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update volume.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update volume.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* f-strings
* Update maths/volume.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* more tests
* fix non negative
* fix 0 radius
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix tests
* fix print
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix comment
* fix comment
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update volume.py
* [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>
* Create malus_law.py
Finding the intensity of light transmitted through a polariser using Malus Law and by taking initial intensity and angle between polariser and axis as input
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update physics/malus_law.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Update physics/malus_law.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Update physics/malus_law.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Update physics/malus_law.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Update malus_law.py
Made some changes in the error messages and the docstring testcases
* Update malus_law.py
Made changes for the passing the precommit
* [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: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Calculate GST Amount
The program helps to get the net amount after GST is added to it.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update financial/calculating GST.py
Thanks!
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update and rename calculating GST.py to price_plus_tax.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update price_plus_tax.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>
* Create minimums_squares_to_represent_a_number.py
added a dynamic programming approach of finding the minimum number of square to represent a number.
eg :
25 = 5*5
37 = 6*6 + 1*1
21 = 4*4 + 2*2 + 1*1
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update and rename minimums_squares_to_represent_a_number.py to minimum_squares_to_represent_a_number.py
updated the code
* Update minimum_squares_to_represent_a_number.py
I have added the appropriate checks for 0 and 12.34.
It would be great if you could suggest a name for the dp array
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_squares_to_represent_a_number.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_squares_to_represent_a_number.py
updated
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_squares_to_represent_a_number.py
updated
* [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>
* added support for inverse of 3x3 matrix
* Modified Docstring and improved code
* fixed an error
* Modified docstring
* Apply all suggestions from code review
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* Added function that checks if a string is an isogram.
* Added wiki reference and fixed comments.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Made function name more self-documenting. Raise ValueError if string contains 1 or more digits. Renamed file. Lowercase string inside function.
* Removed check_isogram.py (file renamed).
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixed test failure.
* Raise ValueError when string has non-alpha characters. Removed import.
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Included area of n sided regular polygon
Added a function to calculate the area of n sided regular polygons
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* code standard fixes as per PR comments
* [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>
* added script for solving system of linear equations in two variables
* implemented all the suggested changes
* changed RuntimeError to ValueError
* Update matrix/system_of_linear_equation_in_2_variables.py
* Update matrix/system_of_linear_equation_in_2_variables.py
* Update and rename system_of_linear_equation_in_2_variables.py to cramers_rule_2x2.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Updated documentation of cnn_classification.py for much better understanding
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update computer_vision/cnn_classification.py
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
* Added Implementation for XNOR gate
* Added Implementation for OR gate
* Added implementation of NAND gate
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added Implementation of NAND gate
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated nand_gate.py
* updated xnor_gate.py after some changes
* Delete due to duplicate file
* Updated xnor_gate.py
* Added Implementation of NOT gate in python
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed a typo error
* Updated to a new logic
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated nand_gate.py file
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Create decimal_conversions.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Create arc_length.py
* Delete decimal_conversions.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Removed redundant statement, fixed line overflow
* Update arc_length.py
Changed rad to radius as not to get confused with radians
* Update arc_length.py
* Update arc_length.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* Create kinetic_energy.py
Finding the kinetic energy of an object,by taking its mass and velocity as input
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update kinetic_energy.py
* Update kinetic_energy.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>
* Add function for xor gate
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add test case for xor functions
* Update boolean_algebra/xor_gate.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update boolean_algebra/xor_gate.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Split long comment line into two lines
* 88 characters per line
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add Spain National ID validator (#7574)
* is_spain_national_id()
* Update is_spain_national_id.py
* Some systems add a dash
Co-authored-by: Christian Clauss <cclauss@me.com>