-
Notifications
You must be signed in to change notification settings - Fork 104
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
bug: Bubble sort infinite loops if 2 values are the same #217
Comments
im on it |
## Pull Request type Please check the type of change your PR introduces: - [X] Bugfix - [ ] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no API changes) - [ ] Build-related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior? Issue Number: #217 ## What is the new behavior? - Bubble sort don't infinite loop anymore when there is equal values ## Does this introduce a breaking change? - [ ] Yes - [X] No ## Other information Also added a test to ensure the problem doesn't happen again
…#219) ## Pull Request type Please check the type of change your PR introduces: - [X] Bugfix - [ ] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no API changes) - [ ] Build-related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior? Issue Number: keep-starknet-strange#217 ## What is the new behavior? - Bubble sort don't infinite loop anymore when there is equal values ## Does this introduce a breaking change? - [ ] Yes - [X] No ## Other information Also added a test to ensure the problem doesn't happen again
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. |
This issues is resolved, can someone close it ? |
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. |
I think
if *array[idx1] < *array[idx2]
should be replace by if*array[idx1] <= *array[idx2]
since it loops infinitely swapping the 2 elements if they are the same values.Maybe that's a feature if you want to sort an array and you know it doesn't contain duplicated values but I don't think it should be the default implementation.
The text was updated successfully, but these errors were encountered: