jwalsh / jwalsh/hy-algorithms

Implement bit manipulation algorithms

Open
#22 0 comments 0 reactions 0 assignees View on GitHub
difficulty:medium math
Dominant language
Hy
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Create implementations for bit manipulation algorithms and techniques:

## Basic operations:
- Set/unset/toggle a bit
- Check if a bit is set
- Count set bits
- Find rightmost set bit
- Isolate rightmost set bit
- Turn off rightmost set bit

## Applications:
- Detect if number is power of 2
- Find missing number in array
- Find two non-repeating elements
- Swap two numbers without temp variable
- Add two numbers without + operator
- Generate all subsets of a set
- Next higher/lower number with same number of set bits

## Bit-level optimizations:
- Divide and multiply by 2
- Fast exponentiation
- Bit manipulation tricks

## Requirements:
- Include detailed explanations of bit operations
- Create visualizations for complex operations
- Document time and space complexity advantages
- Provide practical applications

This collection will demonstrate efficient bit manipulation techniques that can optimize algorithm performance for specific problems.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.