Data Structures

Singly Linked List Using Arrays

My Singly Linked List Article is a direct implementation of Singly Linked List, where the memory allocation of more Nodes is done only when necessary. However, in reality, the computer memory is a contiguous array of memory locations. We can emulate the memory management of a Singly Linked List using Arrays.

Linked List

Linked List is a set of Nodes where a Node is a data and a reference to the next node. The reference to the next node is an item required in the structure of a Linked List because it's not organized sequentially in memory like the Array, although it can also be represented using Arrays as you will see in our implementation of Singly List.

Accessing an element:

Singly Linked List

Singly Linked List is the most basic of Linked List implementations. It's a one-way list of Nodes from Head to Tail! 

To implement a Singly Linked List, we must first create a Node structure (or a class) that will hold the data and the node reference to the next Node.

In C++ we do this by declaring the following SL_Node structure. We will be using templates so we can handle different kinds of data in one single program.

Techniques How to Remove Any Recursion

A function that calls itself is hard to visualize for most developers. Common software requirements are implemented thru loops, arrays, variables, and automated function calls thus making the use of recursion and variations of the list data structure unusual. In this article, we will take a look at how we can remove any recursive program by following the simple techniques described below. It is very important to understand that this article is not saying that recursion is bad.

Arrays

An array is one of the fundamental data structures available and most widely used by developers today to solve general problems. You can think of an array as a collection of variables of a certain data type stored contiguously in memory. The values of an array can be accessed through an index (commonly represented by the variables i, j, and k), and the ith value of an array is denoted as Array[i].

This article is not to be confused with associative arrays, which is a fancy way of calling the key-value-pair data structure. We will discuss it separately.

Subscribe to RSS - Data Structures