* Add XOR-based swap algorithm for two numbers
* updating DIRECTORY.md
* Include additional test case for xor_swap function
Add example for xor_swap with larger integers
---------
Co-authored-by: Balamurugan315 <balamuruganmsde@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
* Add set bits count using lookup table method
Introduced get_set_bits_count_using_lookup_table to efficiently count set bits in a 32-bit integer using a precomputed lookup table. Updated benchmark to compare the new method alongside existing algorithms.
* Update count_number_of_one_bits.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update count_number_of_one_bits.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update count_number_of_one_bits.py
Reduced line size
---------
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 is_even_using_shift_operator function
Introduces a new function to check if a number is even using bitwise shift operators. Includes docstring with explanation and doctest examples.
* [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>
* Fix zero input bug in binary_count_trailing_zeros
* [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>
* Add Fast Walsh-Hadamard Transform (FWHT) for bitwise convolutions
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* refactor: remove unnecessary whitespace in fast_walsh_hadamard_transform.py
* Move fast_walsh_hadamard_transform.py to bit_manipulation
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add find_unique_number algorithm to bit manipulation
* [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>
* use format to remove '0b'
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: error message for float input
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Create find_previous_power_of_two.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update find_previous_power_of_two.py
This change avoids the unnecessary left shift operation
* Update find_previous_power_of_two.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>
* added excess-3 code
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updated with fixes
* updated with fixes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update excess_3_code.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 swap_all_odd_and_even_bits.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update swap_all_odd_and_even_bits.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* 6: 00000110 --> 9: 00001001
* Update swap_all_odd_and_even_bits.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>
* added decimal to bcd sequence
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updated with fixes
* Update and rename bcd_sequence.py to binary_coded_decimal.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update binary_coded_decimal.py
* Update binary_coded_decimal.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>
* Fix incorrect range detection in find_missing_number
* Support consecutive decreasing numbers
Added support for consecutive decreasing numbers in the find_missing_number function.
* Support unordered numbers
* added power_of_4
* updated power_of_4
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updated power_of_4
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updated power_of_4
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updated power_of_4
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updated power_of_4
* added type check
* added tescase
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Added missing_number algorithm using bit manipulation
* Update bit_manipulation/missing_number.py
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
* add is power of two
* fix comment
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Deal with negative numbers
* Spelling: negative
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added algorithm for finding index of rightmost set bit
* applied suggested changes
* applied suggested changes
* Fixed failing Testcases
* [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 count_number_of_one_bits.py
removed the modulo operator as it is very time consuming in comparison to the and operator
* Update count_number_of_one_bits.py
Updated with the timeit library to compare. Moreover I have updated my code which helps us in reaching the output comparatively faster.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update bit_manipulation/count_number_of_one_bits.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update count_number_of_one_bits.py
Updated the code
* Update count_number_of_one_bits.py
Updated code
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Run the tests before running the benchmarks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* consistently
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added 5 README files
* corrected arithmetic_analysis README
* Update audio_filters/README.md
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Update backtracking/README.md
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Update bit_manipulation/README.md
Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Added a gray_code_sequence.py file to the bit_manipulation folder
* Added a descriptive name for variable n changing it to bit count
* Update gray_code_sequence.py
Co-authored-by: krishchopra02 <krishchopra02@gmail.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Fix several typos
* Update bit_manipulation/README.md
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Update double_sort.py
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Added binary shifts and twos complement functions to bit manipulation package
* Fixed problem representing 0 wrong
* More testing
* Fixed problems
* Fixed formatting
* More format fixes
* Format fixes
* Fixed docstrings and added url
* Minor change to url