Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working binary insertion sort in Python #8024

Merged
merged 6 commits into from
May 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added binary insertion sort working
  • Loading branch information
shricubed committed Dec 8, 2022
commit 03dca58dae0ae512071b42ccad2c27b9c2e8681c
3 changes: 2 additions & 1 deletion sorts/binary_insertion_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def binary_insertion_sort(collection):
n = len(collection)
for i in range(1, n):
val = collection[i]
low = 0, high = i - 1
low = 0
high = i - 1

while low <= high:
mid = (low + high) // 2
Expand Down