Skip to content

Commit

Permalink
include trailing_zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
rikojacob committed Feb 15, 2018
1 parent 86fc687 commit 7642ad9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions algs4/fundamentals/java_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ def java_string_hash(key):
for c in key:
h = (31 * h + ord(c)) & 0xFFFFFFFF
return ((h + 0x80000000) & 0xFFFFFFFF) - 0x80000000

def trailing_zeros(i):
zeros = 0
while i & 1 == 0 and zeros < 32:
zeros += 1
i = i >> 1
return zeros
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="algs4_python",
version="0.2.1.5",
version="0.2.1.6",
packages= [
'algs4.fundamentals',
'algs4.sorting',
Expand Down

0 comments on commit 7642ad9

Please sign in to comment.