# Empirical Evaluation of Unoptimized Sorting Algorithms on 8-Bit AVR Arduino Microcontrollers

**Authors:** Julia Golonka, Filip Krużel

PMC · DOI: 10.3390/s26010214 · Sensors (Basel, Switzerland) · 2025-12-29

## TL;DR

This paper compares how different sorting algorithms perform on low-resource Arduino microcontrollers, showing which ones are fastest and use the least memory.

## Contribution

The study provides empirical performance comparisons of unoptimized sorting algorithms on 8-bit AVR microcontrollers, highlighting trade-offs between speed and memory usage.

## Key findings

- Heap Sort offered the best trade-off between runtime and memory usage for sorting on Arduino boards.
- Merge Sort, while fast, consumed too much memory on the Arduino Uno, nearly exhausting its 2 kB SRAM.
- Quick Sort was efficient in runtime but failed on larger datasets due to high stack usage on constrained boards.

## Abstract

Resource-constrained sensor nodes in Internet-of-Things (IoT) and embedded sensing applications frequently rely on low-cost microcontrollers, where even basic algorithmic choices directly impact latency, energy consumption, and memory footprint. This study evaluates six sorting algorithms—Bubble Sort, Insertion Sort, Selection Sort, Merge Sort, Quick Sort, and Heap Sort—in the restricted environment that microcontrollers provide. Three Arduino boards were used: Arduino Uno, Arduino Leonardo, and Arduino Mega 2560. Each algorithm was implemented in its unoptimized form and tested on datasets of increasing size, emulating buffered time-series sensor readings in random, ascending, and descending order. Execution time, number of write operations, and memory usage were measured. The tests show clear distinctions between the slower O(n2) algorithms and the more efficient O(nlogn) algorithms. For random inputs of n=1000 elements, Bubble Sort required 1,958,193.75 μson average, whereas Quick Sort completed it in 54,260.50 μs and Heap Sort in 92,429.00 μs, i.e., speedups of more than one order of magnitude compared to the quadratic baseline. These gains, however, come with very different memory footprints. Merge Sort kept the runtime below 100,000 μs at n=1000 but required approximately 2023 bytes of additional static random-access memory (SRAM), effectively exhausting the 2 kB SRAM of the Arduino Uno. QuickSort used approximately 311 bytes of extra SRAM and failed to process larger ascending and descending datasets on the more constrained boards due to its recursive pattern and stack usage. Heap Sort offered the best overall trade-off: it successfully executed all tested sizes up to the SRAM limit of each board while using only about 12–13 bytes of additional SRAM and keeping the runtime below 100,000 μs for n=1000. The results provide practical guidelines for selecting sorting algorithms on 8-bit AVR Arduino-class microcontrollers, which are widely used as simple sensing and prototyping nodes operating under strict RAM, program-memory, and energy constraints.

## Full-text entities

- **Diseases:** injury to (MESH:D014947)
- **Chemicals:** EEPROM (-)
- **Species:** Homo sapiens (human, species) [taxon 9606]

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/PMC12788153/full.md

## Figures

33 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12788153/full.md

## References

23 references — full list in the complete paper: https://tomesphere.com/paper/PMC12788153/full.md

---
Source: https://tomesphere.com/paper/PMC12788153