Cocktail Sort is an improved version of Bubble Sort. It also goes through the list, but it moves in both directions. First, it sorts from left to right, pushing the largest unsorted item to the end. Then, it reverses and sorts from right to left, pushing the smallest unsorted item to the beginning.
Cocktail Sort is often better for large or partly sorted lists because it reduces the number of passes needed.
Record
[X] I agree to follow this project's Code of Conduct
[X] I want to work on this issue
[X] I'm willing to provide further clarification or assistance if needed.
Is there an existing issue for this?
Feature Description
Cocktail Sort is an improved version of Bubble Sort. It also goes through the list, but it moves in both directions. First, it sorts from left to right, pushing the largest unsorted item to the end. Then, it reverses and sorts from right to left, pushing the smallest unsorted item to the beginning. Cocktail Sort is often better for large or partly sorted lists because it reduces the number of passes needed.
Record
Full Name
Harpreet Kaur
Participant Role
GSOC