The collection of data you work with in a program have some kind of structure or organization of data In Data Structures. No matte how complex your data structures are they can be broken down into two fundamental types.

- Contiguous
- Non-Contiguous

In contiguous structures, terms of data are kept together in memory (either RAM or in a file). An array is an example of a contiguous structure. Since each element in the array is located next to one or two other elements.

In contrast, items in a non-contiguous structure and scattered in memory, but we linked to each other in some way. A linked list is an example of a non-contiguous data structure. Here, the nodes of the list are linked together using pointers stored in each node.

## Contiguous Data Structures

Contiguous structures can be broken drawn further into two kinds: those that contain data

items of all the same size, and those where the size may differ. In the above diagram, the first kind is called the array, shows an example of an array of numbers. In an array, each element is of the same type, and thus has the same size.

The second kind of contiguous structure is called structure, Non-contiguous shows a simple structure consisting of a person’s name and age. In a struct, elements may be of different data types and thus may have different sizes.

For example, a person’s age can be represented with a simple integer that occupies two bytesof memory. But his or her name, represented as a string of characters, may require many bytes and may even be of varying length.

Couples with the atomic types (that is, the single data-item built-in types such as integer, float and pointers), arrays and structs provide all the “mortar” you need to built more exotic form of data structure, including the non-contiguous forms.

## Non-contiguous structures:

Non-contiguous structures are implemented as a collection of data-items, called nodes, where each node can point to one or more other nodes in the collection. The simplest kind of non- contiguous structure is linked list.

A linked list represents a linear, one-dimension type of non-contiguous structure, where there is only the notation of backwards and forwards.

A tree such as shown in figure 1.4(b) is an example of a two-dimensional non-contiguous structure. Here, there is the notion of up and down and left and right.

In a tree each node has only one link that leads into the node and links can only go down the tree. The most general type of non-contiguous structure, called a graph has no such restrictions.

Happy Learning 🙂