You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The current implementation of the Swap Sort algorithm can enter an infinite loop, particularly when dealing with arrays containing duplicate values. This issue was observed in the test case shouldAcceptWhenArrayWithDuplicateValueIsPassed.
Problem
The index variable in the sorting logic is not being updated correctly. As a result, the index may never reach len - 1, causing the algorithm to loop indefinitely.
Solution
Fix the logic to ensure the index variable is updated appropriately.
Add the missing test case to validate the sorting of arrays with duplicate values.
Steps to Reproduce
Steps to reproduce
Run the test case shouldAcceptWhenArrayWithDuplicateValueIsPassed.
Observe that the algorithm enters an infinite loop.
Expected Behavior
Excepted behavior
The algorithm should sort the array correctly and terminate without entering an infinite loop.
Screenshots
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Description
Description
The current implementation of the Swap Sort algorithm can enter an infinite loop, particularly when dealing with arrays containing duplicate values. This issue was observed in the test case shouldAcceptWhenArrayWithDuplicateValueIsPassed.
Problem
The index variable in the sorting logic is not being updated correctly. As a result, the index may never reach len - 1, causing the algorithm to loop indefinitely.
Solution
Fix the logic to ensure the index variable is updated appropriately.
Add the missing test case to validate the sorting of arrays with duplicate values.
Steps to Reproduce
Steps to reproduce
Run the test case shouldAcceptWhenArrayWithDuplicateValueIsPassed.
Observe that the algorithm enters an infinite loop.
Expected Behavior
Excepted behavior
The algorithm should sort the array correctly and terminate without entering an infinite loop.
Screenshots
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: