Collection of useful recursive functions.
The elegant recursive solution to a problem is most of the times invaluable. Although the iterative solution of that problem is likely to have a better space and time complexity, it is often preferred...
View ArticleImplementation of graph representation with an adjacency list.
The following program reads a set of edges that define a graph and creates a representation of this graph with an adjacency list. The adjacency list of a graph is an array of lists, one for each...
View ArticleImplement simple reverse list iteratively.
The function ‘reverse’ in the following example reverses the links in a list, returning a pointer to the end node, which then shows the next of the last node, and so forth, while the link to the first...
View ArticleArduino: A library for implementing a generic, dynamic queue (linked list...
This project refers to an Arduino library for implementing a generic, dynamic queue (linked list version). The data structure is implemented as a class in C++. For more information, you can get the...
View ArticleArduino: A library for implementing a generic, dynamic stack (linked list...
This project refers to an Arduino library implementing a generic, dynamic stack (linked list version). The data structure is implemented as a class in C++. For more information, you can get the project...
View ArticleImplementation of insertion sort algorithm for single linked lists.
The following program generates N random integers between 0 and 999, creates a linked list inserting a number in each node and then rearranges the nodes of the list so that the numbers appear sorted...
View ArticleImplementation of a circular list for solving the problem of Josephus.
For the representation of individuals arranged in a circle, we create a circular linked list with a combination of each person to the person on his left in the circle. The integer i represents the i-th...
View Article