Minor fixes. (#91)

* Get Bit: Make more terse

* Power of two: Allowed 1 as a valid power of 2.
Power of two: Removed unnecessary exception throwing.

* Fisher Yates: Made more terse

* Least Common Multiple: Fill undefined value

* Greatest Common Divisor: Fill undefined value.
Greatest Common Divisor: Make more terse.
This commit is contained in:
Bruce-Feldman
2018-07-04 10:53:22 -04:00
committed by Oleksii Trekhleb
parent 93bfe97e27
commit e36c441fa9
10 changed files with 15 additions and 75 deletions

View File

@ -2,12 +2,7 @@
#### Get Bit
This method shifts `1` over by `bitPosition` bits, creating a
value that looks like `00100`. Then we perform `AND` operation
that clears all bits from the original number except the
`bitPosition` one. Then we compare the result with zero. If
result is zero that would mean that original number has `0` at
position `bitPosition`.
This method shifts the relevant bit to the zeroth position. Then we perform 'AND' operation with one which has bit pattern like '00001'. This clears all bits from the original number except the relevant one. If the relevant bit is one, the result is '1', otherwise the result is '0'.
> See `getBit` function for further details.