Skip to content

Commit

Permalink
Create heapsort.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gsilvamartin authored Feb 24, 2024
1 parent 34741ae commit 24d4917
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/docs/algorithms/sorting/heapsort.md
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.

0 comments on commit 24d4917

Please sign in to comment.