Skip to content

feat: Add CheckBitParity new algorithm with Junit tests #5728

@Tanmay-Singh3004

Description

@Tanmay-Singh3004

What would you like to Propose?

Implement an algorithm that checks whether the number of 1's in the binary representation of an integer is even or odd. This is useful for parity checking in error detection and data transmission

Issue details

We need to implement an algorithm that checks the parity of the number of 1 bits in the binary representation of a given integer.

The algorithm should return:

  • true if the number of 1 bits is even (even parity),
  • false if the number of 1 bits is odd (odd parity).

Functionality:

  • Input: A single integer n (can be positive or negative).
  • Output: A boolean value indicating the parity of the number of 1 bits in the binary representation of the integer:

Additional Information

Approach:

Use bit manipulation to count the 1 bits in the integer.
Perform a parity check on the count of 1 bits (mod 2) to determine if it is even or odd.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions