-
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
34741ae
commit 24d4917
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# HeapSort Class | ||
|
||
**Provides methods for performing Heap Sort on arrays.** | ||
|
||
## HeapSort Class Members | ||
|
||
```csharp | ||
Sort<T>(this T[] array) where T : IComparable<T> | ||
``` | ||
|
||
Sorts an array using the Heap Sort algorithm. | ||
|
||
## Parameters | ||
|
||
- `array` (Type: `T[]`): The array to be sorted. | ||
|
||
## Returns | ||
|
||
- Type: `T[]` | ||
- Description: The sorted array. | ||
|
||
## Example | ||
|
||
```csharp | ||
using NetPlus.Algorithms.Sorting; | ||
|
||
// Example array | ||
int[] myArray = { 4, 2, 7, 1, 9 }; | ||
|
||
// Sorting the array using Heap Sort | ||
var sortedArray = myArray.ExecuteHeapSort(); | ||
|
||
// Displaying the sorted array | ||
Console.WriteLine(string.Join(", ", sortedArray)); | ||
``` | ||
|
||
## Usage | ||
|
||
To use the HeapSort class, simply call the `ExecuteHeapSort` method on your array. | ||
|
||
```csharp | ||
int[] myArray = { 4, 2, 7, 1, 9 }; | ||
var sortedArray = HeapSort.ExecuteHeapSort(myArray); | ||
``` | ||
|
||
## Remarks | ||
|
||
The `HeapSort` class uses the Heap Sort algorithm to sort arrays. It is an in-place sorting algorithm. |