Data Structures using C PlusPlus: Chapter 5: Linked Lists

C++ Representation of Linked List

Questions: 1. What is the need of linked list ? 2. Write a note on singly linked lists.

C++ Representation of Linked List

typedef struct node

{

      int data; /* data field */

      struct node * next; /* link field */

}SLL;


while declaring C++ structure for a linked list ‒

• Declare a structure in which two members are there i.e. data member and next pointer member.

• The data member can be character or integer or real kind of data depending upon the type of the information that the linked list is having.

• The 'next' member is essentially of a pointer type. And the pointer should be of structure type. Because the 'next' field holds the address of next node. And each node is basically a structure consisting of 'data' and 'next'.


Advantages of linked organization :

1. In linked organization, insertion and deletion of elements can be efficiently done.

2. There is no wastage of memory. The memory can be allocated and deallocated as per requirement.


Disadvantages of linked organization :

1. Linked organization does not support random or direct access.

2. Each data field should be supported by a link field to point to next node.

 

Key Point

The linked list is a collection of nodes. Each node consists of two fields: 'data' field and 'link' field.

 

Reveiw Questions

1. What is the need of linked list ?

2. Write a note on singly linked lists.

 

Data Structures using C PlusPlus: Chapter 5: Linked Lists : Tag: Data Structure, C++ Programing : - C++ Representation of Linked List


Data Structures using C PlusPlus: Chapter 5: Linked Lists



Under Subject


Data Structures using CPlusPlus

CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation



Related Subjects


English Essentials II

EN25C02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation



Linear Algebra

MA25C02 2nd Semester | 2025 Regulation


Electron Devices

EC25C01 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Data Structures using CPlusPlus

CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Circuits and Network Analysis

EC25C02 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Re-Engineering for Innovation

ME25C05 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation


Engineering Drawing - Laboratory

ME25C01 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation


Data Structures using CPlusPlus - Laboratory

CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Devices and Circuits Laboratory

EC25C03 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation