Update measure-HeapSort.ps1

This commit is contained in:
Markus Fleschutz 2023-08-21 20:28:30 +02:00
parent 7c3775538d
commit c5414bd312

View File

@ -1,4 +1,27 @@
param([int]$numIntegers = 1000)
<#
.SYNOPSIS
Measures the speed of HeapSort
.DESCRIPTION
This PowerShell script measures the speed of the HeapSort algorithm.
HeapSort is a comparison-based sorting algorithm. Heapsort can be thought of as an
improved selection sort: like selection sort, heapsort divides its input into a sorted
and an unsorted region, and it iteratively shrinks the unsorted region by extracting
the largest element from it and inserting it into the sorted region. Unlike selection
sort, heapsort does not waste time with a linear-time scan of the unsorted region;
rather, heap sort maintains the unsorted region in a heap data structure to more quickly
find the largest element in each step.
.PARAMETER numIntegers
Specifies the number of integers to sort
.EXAMPLE
PS> ./measure-HeapSort.ps1
🕒 HeapSort of 1000 integers took 0.6145732 sec
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([int]$numIntegers = 1000)
class HeapSort {
static Sort($targetList) {