[PR #802] [feat/fix/docs]: Fix bubble_sort2.c implementation bug and some documentation/structure improvements #1322

Open
opened 2026-01-29 15:19:16 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/TheAlgorithms/C/pull/802

State: closed
Merged: Yes


Description of Change

As of now, the implementation of the bubble-sort algorithm in bubble_sort2.c is not working.

int i, arraySort[MAX] = {0}, isSort = FALSE, changePlace;
 // ...
while (isSort) { // sorting code... }

The above snippet illustrates the problem. The flag isSort is initially set to FALSE and, consequently, the loop where the array would be sorted never runs. Other than that, we can also see camelCase being used and the lack of a separate test function and documentation as per CONTRIBUTING.md instructions.

Checklist

  • replace camelCase by snake_case
  • add a separate test function
  • fix bug with isSort flag
  • document code
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.
**Original Pull Request:** https://github.com/TheAlgorithms/C/pull/802 **State:** closed **Merged:** Yes --- #### Description of Change As of now, the implementation of the bubble-sort algorithm in [bubble_sort2.c](https://github.com/TheAlgorithms/C/blob/master/sorting/bubble_sort_2.c) is not working. ```c int i, arraySort[MAX] = {0}, isSort = FALSE, changePlace; // ... while (isSort) { // sorting code... } ``` The above snippet illustrates the problem. The flag `isSort` is initially set to [`FALSE`](https://github.com/TheAlgorithms/C/blob/master/sorting/bubble_sort_2.c#L5) and, consequently, the loop where the array would be sorted never runs. Other than that, we can also see _camelCase_ being used and the lack of a separate test function and documentation as per `CONTRIBUTING.md` [instructions](https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md#typical-structure-of-a-program). #### Checklist - [x] replace camelCase by snake_case - [x] add a separate test function - [x] fix bug with `isSort` flag - [x] document code - [x] PR title follows semantic [commit guidelines](https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md#Commit-Guidelines) - [x] Search previous suggestions before making a new one, as yours may be a duplicate. - [x] I acknowledge that all my contributions will be made under the project's license.
claunia added the pull-request label 2026-01-29 15:19:16 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#1322