beam: fix rotated_binary_search test pivot expectation (left-rotation semantics)

This commit is contained in:
beam committed 2026-10-30 07:11:14 +00:00
1 parent 85cc9e6963
commit 4620260e43
1 file changed
+3 -2
@@ -24,8 +24,9 @@ def test_rotated():
base = [1,2,3,4,5,6,7]
for r in range(len(base)):
arr = base[r:] + base[:r]
assert find_pivot(arr) == r, (r, find_pivot(arr))
assert count_rotations(arr) == r
expected_pivot = (len(base) - r) % len(base)
assert find_pivot(arr) == expected_pivot, (r, find_pivot(arr), expected_pivot)
assert count_rotations(arr) == expected_pivot
for t in base:
i = search(arr, t)
assert i != -1 and arr[i] == t