Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing two items at a time and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which means the list is sorted. The algorithm gets …
Category Archive: Arrays
Apr 02 2008
Sort Arrays – Merge Sort
In computer science, merge sort or mergesort is an O(n log n) comparison-based sorting algorithm. It is stable, meaning that it preserves the input order of equal elements in the sorted output. It is an example of the divide and conquer algorithmic paradigm. It was invented by John von Neumann in 1945. Merge Sort Animation …
Apr 02 2008
Sorting Arrays – Quick Sort
Quicksort in action on a list of random numbers. The horizontal lines are pivot values.Quicksort is a well-known sorting algorithm developed by C. A. R. Hoare that, on average, makes (big O notation) comparisons to sort n items. However, in the worst case, it makes L(n2) comparisons. Typically, quicksort is significantly faster in practice than …
Apr 02 2008
Worst Case Array Statistics
Worst case means that the array is already sorted in reverse order from the required. Worst Case Function just loop from max to min to create a sorted array in descending order Worst Case Function Public Sub WorstCase( ByRef arr(), Byval nSize ) Dim i, nCount Redim arr( nSize – 1 ) nCount = 0 …
Apr 02 2008
Sorting Arrays – Heap Sort
Heapsort is a comparison-based sorting algorithm, and is part of the selection sort family. Although somewhat slower in practice on most machines than a good implementation of quicksort, it has the advantage of a worst-case O(n log n) runtime. Heapsort is an in-place algorithm, but is not a stable sort. Heap Sort Animation Heapsort inserts …


Recent Comments