Forum Discussion
Chyma
Jul 11, 2021Copper Contributor
VBA algorithm for sorting
Hello, I need help with my task in the school, I should write my own bubble for sorting in alphabetic order and not use build-in functions. I know how to do it for numbers but I have no idea how to d...
anupambit1797
Iron Contributor
HiHansVogelaar , how can we check the Performance of different sorting algo using Excel?
Thanks in Advance,
Br,
Anupam
HansVogelaar
Feb 06, 2024MVP
Use code like this:
Sub TestBubbleSort()
Dim t As Single ' to keep track of time
Dim MyArray ' Array to be sorted
' Set up MyArray
' ...
t = Timer
Call BubbleSort(MyArray)
t = Timer - t
Debug.Print "Bubble Sort took " & t & " seconds"
End Sub
Create similar macros for other sorting algorithms that you want to test: insert sort, heap sort, comb sort, quick sort, ...