While all comparison-based algorithms have a time complexity of O(nlogn) to sort an array of n elements, there are sorting algorithms running in linear time provided that some assumptions are verified.
Ring buffers (also known as circular buffers) are fixed-size buffers that works as if the memory were contiguous and circular.
The most straightforward application of recursion is to replace iteration using a recursive function instead of for/while loops. Such recursive functions allow to iterate over data structures, taking as parameter the index that would be used in a for loop. As an example, let's consider the following code printing a c++ vector:
Recursion is the process of defining a problem in terms of itself and it is a powerful tool in defining algorithms.