-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b8ce22
commit e3a7980
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,49 @@ | ||
# BubbleSort Class | ||
|
||
Provides methods for performing Bubble Sort on arrays. | ||
|
||
## BubbleSort Class Members | ||
|
||
```csharp | ||
ExecuteBubbleSort<T>(this T[] array) where T : IComparable<T> | ||
``` | ||
|
||
Sorts an array using the Bubble Sort algorithm in ascending order. | ||
|
||
#### Parameters | ||
|
||
- `array` (Type: `T[]`): The array to be sorted. | ||
|
||
#### Returns | ||
|
||
- Type: `T[]` | ||
- Description: The sorted array in ascending order. | ||
|
||
#### Example | ||
|
||
```csharp | ||
using NetPlus.Algorithms.Sorting; | ||
|
||
// Example array | ||
int[] myArray = { 4, 2, 7, 1, 9 }; | ||
|
||
// Sorting the array using Bubble Sort | ||
var sortedArray = myArray.ExecuteBubbleSort(); | ||
|
||
// Displaying the sorted array | ||
Console.WriteLine(string.Join(", ", sortedArray)); | ||
``` | ||
|
||
#### Usage | ||
|
||
To use the BubbleSort class, simply call the ExecuteBubbleSort method on your array. | ||
|
||
```csharp | ||
int[] myArray = { 4, 2, 7, 1, 9 }; | ||
var sortedArray = BubbleSort.ExecuteBubbleSort(myArray); | ||
``` | ||
|
||
#### Remarks | ||
|
||
The BubbleSort class uses the Bubble Sort algorithm to sort arrays in ascending order. | ||
It is an in-place sorting algorithm. |