Closed
Description
unlike other python files bitonic_sort.py
Doesn't have any proper input statement :
a = []
n = int(input().strip())
for i in range(n):
a.append(int(input().strip()))
up = 1
sort(a, n, up)
print("\n\nSorted array is")
for i in range(n):
print("%d" % a[i])
It's quit Confusing because user who haven't seen the code won't know what is the first input.
It should be written as :
user_input = input("Enter numbers separated by a comma:\n").strip()
unsorted = [int(item) for item in user_input.split(",")]
up = 1
sort(unsorted,len(unsorted), up)
print("\nSorted array is")
print(*unsorted, sep=",")
This not only removes a loop but also makes to more understandable
Metadata
Metadata
Assignees
Labels
No labels