Puedes seguirnos en

BUSCADOR

Engineering

Linked list in Data Structure

The linked list consist of a series of structures. They are not required to be stored in adjacent memory locations. Each structure consist of a data field and address field. Address field contains the address of its successor.

A variable of the above structure type is conventionally known as a node.
A list consisting of three data x1,x2,x3 is represented using a linked list. Node A stores the data x1 and the address of the successor (next) node B. Node B stores the data x2 and the address of its successor node C. Node C contains the data x3 and its address field is grounded (NULL pointer), indicating it does not have a successor.
Structures in “C” can be used to define a node. Address of the successor node can be stored in a pointer type variable.

typedef struct ListNode
{
int data;
struct ListNode *next;
}Node;

It is a self referential structure in “C”. It is assumed that the type of data to be stored in each node is predefined to be of integer type. Next field of the structure is a pointer type variable, used for storing address of its successor node. Nodes are manipulated during run-time. A programming language must provide following facilities for run time manipulation of nodes.
Acquring memory for storage during run-time.
Freeing memory during execution of the program, once the need for the acquired is over.

Anuncio publicitario

In “C” programming language, memory can be acquired through the use of standard library functions malloc() and calloc(). Memory acquired during runtime can be freed through the use of library function free().

Video tutorial:

Anuncio publicitario
Escrito por

Administrador de ENGGDRCAOS. Canal dedicado especialmente a la formación del estudiante que aspira a ser ingeniero. Todos los videos son Ingles. Apasionado del universo Apple, estudiante de Ingeniería y Gamer por vocación.

Publicidad

ARTÍCULOS RELACIONADOS

Ciencia y tecnología

Seguramente todos alguna vez en nuestra vida hemos borrado por error un archivo que realmente no queríamos eliminar, una fotografía, un documento importante, una...

Ciencia y tecnología

Seguramente todos alguna vez en nuestra vida hemos borrado por error un archivo que realmente no queríamos eliminar, una fotografía, un documento importante, una...

Engineering

Singly linked list is a dynamically allocated list, which consists of one or more nodes. Each node contains a pointer which holds the address...

Engineering

Queue is a very useful data structure. Various features of operating system are implemented using queue. Scheduling of processes (Round Robin Algorithm) Spooling (to...