Skip to content
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

Create BubbleSort.cpp #2287

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AnuragITrmlau
Copy link

@AnuragITrmlau AnuragITrmlau commented Oct 28, 2023

This C++ program uses the bubble sort algorithm to sort an array of integers. The function bubbleSort takes an array and its length as parameters. It iterates through the array multiple times, comparing each pair of adjacent elements and swapping them if they are in the wrong order. This process continues until the array is sorted.

The function printArray is used to print the array elements.

In the main function, an array of integers is initialized, and its length is calculated. The bubbleSort function is then called to sort the array, and the sorted array is printed using the printArray function.

The Following Output for the code will be :

Sorted array:
11 12 22 25 34 64 90

Pull Request

Related issue

Fixes #<issue_number>

What does this PR do?

  • ...

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

This C++ program uses the bubble sort algorithm to sort an array of integers. The function bubbleSort takes an array and its length as parameters. It iterates through the array multiple times, comparing each pair of adjacent elements and swapping them if they are in the wrong order. This process continues until the array is sorted.

The function printArray is used to print the array elements.

In the main function, an array of integers is initialized, and its length is calculated. The bubbleSort function is then called to sort the array, and the sorted array is printed using the printArray function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant