Home / Codes / Implementing Bubble Sort in AVR/Arduino

Implementing Bubble Sort in AVR/Arduino

This is a short note on implementing the Bubble Sort algorithm on the AVR and Arduino microcontrollers. Bubble sort or sinking sort is one of the many sorting algorithms. In this algorithm,  a list is repeatedly read where each line is compared to adjacent elements and swaps them if they are in the wrong order. The algorithm stops once all the elements in the list is sorted.

In the application note, the subroutine “bubble” sorts up to 224 bytes of SRAM data which is the SRAM area that can be reached by the lower eight bits of a pointer.

The flow-chart of the bubble sort algorithm is shown:

bubble sort algorithm

Source code: Download

Full application note:


Check Also

arduino array

Using Arrays in Arduino Programming

An array is a data structure for storing multiple variables of the same data type. …

Leave a Reply

Your email address will not be published. Required fields are marked *