-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Missing Edge Case for odd_even_transposition_parallel.py #10925
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
Comments
maybe try sorted_lst = sorted(lst) |
Hi @ufraan, I'm not sure what you're referring to. The code you provided would output a sorted list but the error is in the algorithm's implementation. |
It occurs to me that this may be an issue with how M1 Macs handle multiprocessing based on this: https://stackoverflow.com/questions/65859890/python-multiprocessing-with-m1-mac Can anyone confirm if |
I ran the odd_even_transposition(list(range(11)[::-1])) test case and it is giving the output 1 0 3 2 5 4 7 6 9 8 10 |
Hey, @RaymondDashWu , I just found what is the problem with this algorithm, so can you please assaign me this issue. Thank you...✌️ |
Awesome @gyan313 ! Issues aren't assigned in this repo so feel free to just make a PR. |
Hey, @RaymondDashWu , I just opened a pr #10976 , can you review that please❤️...Thanks |
Ah I didn't realize there was a hard coded range(10) in there. Nice catch! I'm not a maintainer though so I won't be the one merging the PR. |
Marking this as closed since a PR has been made containing the fix |
Repository commit
28302db
Python version (python --version)
3.11.6
Dependencies version (pip freeze)
Only default libraries used in this file
Expected behavior
When creating tests for this file I found a bug. Creating a list with 0 to 11 (or higher) in reverse leads to odd behavior. However, creating a list from 0 to 10 and 0 to 5 seems to work.
odd_even_transposition(list(range(11)[::-1]))
outputs[1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 10]
Actual behavior
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
The text was updated successfully, but these errors were encountered: