• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 2 fuera de 11 páginas
Notas de lectura

Linked Lists and Its Types – Singly, Doubly & Circular Linked Lists | DSA Study Notes

Document preview thumbnail
Vista previa 2 fuera de 11 páginas

Complete and easy-to-understand study notes on Linked Lists and Their Types in Data Structures & Algorithms (DSA). These notes cover the basic concept of linked lists and the three major types: Singly Linked List, Doubly Linked List, and Circular Linked List. The content is organized for easy learning, quick revision, quizzes, assignments, and exam preparation. Topics Covered: Introduction to Linked Lists Linked List Structure Nodes and Pointers Singly Linked List Doubly Linked List Circular Linked List Differences between Linked List Types Advantages and Disadvantages Linked List Operations Insertion and Deletion Traversal Basic DSA concepts and examples Suitable For: Computer Science students Data Structures & Algorithms students University exam preparation DSA assignments and quizzes Quick revision and study

Vista previa del contenido

1. Linked Lists
Linked lists are linear data structures where elements (called nodes) are not stored
in contiguous memory locations. Each node contains data and a pointer (or reference)
to the next node. Unlike arrays, linked lists allow dynamic memory allocation,
meaning their size can grow or shrink during runtime.

Advantages over arrays:

 Dynamic size (memory is allocated as needed).
 Easy insertion and deletion at any position.

Disadvantages:

 Extra memory for storing pointers.
 No direct access to elements (traversal is needed).

Structure of a node:

[Data | Next]

Where Data is the actual value and Next is the pointer to the next node.


2. Singly Linked List (SLL)
A singly linked list is the simplest type of linked list where each node points only to
the next node. The last node points to NULL, indicating the end of the list.

2.1 Structure of Singly Linked List
 Node: Contains two fields – data and next.
 Head: Pointer to the first node.
 Tail: Optional, points to the last node.

Diagram:
Head -> [Data|Next] -> [Data|Next] -> [Data|Next] -> NULL


2.2 Operations on Singly Linked List
2.2.1 Traversal

Visiting each node from head to tail.

Example Program: Traversal

, Write a program that creates a singly linked list with three nodes
containing the values 10, 20, and 30. It then traverses the list from the
head node to the last node, printing each node's data followed by an
arrow (->). Finally, it prints NULL to indicate the end of the list.

#include <iostream>

using namespace std;

// Step 1: Define the structure of a Node

struct Node {

int data; // This will hold the value of the node

Node* next; // This will point to the next node in the list

};

int main() {

// Step 2: Create three nodes dynamically

Node* first = new Node(); // First node

Node* second = new Node(); // Second node

Node* third = new Node(); // Third node

// Step 3: Assign data to each node

first->data = 10;

second->data = 20;

third->data = 30;

// Step 4: Connect the nodes to form the linked list

first->next = second; // First node points to second node

second->next = third; // Second node points to third node

third->next = NULL; // Last node points to NULL (end of list)



// Step 5: Traverse the list and print the values

Información del documento

Subido en
4 de octubre de 2026
Número de páginas
11
Escrito en
2026/2027
Tipo
Notas de lectura
Profesor(es)
Zain
Contiene
Todas las clases
$3.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
43
Última venta
-



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes