Bubble sort in C/AL
Published in
1 min readMar 1, 2016
Sorting.. Yes, I could have used Record.SETCURRENTKEY() if I am retrieving values from a table. But I had to sort some decimal/integer variables which I used while running a report.
I was thinking what if I use one of the old school sorting algorithms, and then I decided to implement Bubble Sort in C/AL. You may argue that the complexity of a Bubble Sort is meh.. but personally, I like this algorithm because it is quite easy to implement.
Here is the code.
Here are the results.
Fun fact:
Here is the visualization of how the Bubble Sort Algorithm works.