DSA-Linked-List-.. learning process.pptx

ArgeeOnaler 30 views 15 slides May 17, 2024
Slide 1
Slide 1 of 15
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15

About This Presentation

Good to know as programmer


Slide Content

LINKED LIST { } ...

WHAT IS LINKED LIST? A Linked list is a linear data structure where each is a separate objects, known as a node. each node contains some data and points to the next node in the structure, forming sequence. This structure allows for efficient insertion or removal of elements from any position as only the link is needed to be modified to point to some other element.

T he Node Each node in its basic contains has two portions; the data, and references to the next node in the sequence. In C, we define node as a structure that has the data and the reference pointer information.

ADVANTAGES OVER AN ARRAY NODE 1.Not fixed in size: linked list are not fixed in size unlike that of arrays, hence they can grow and shrink depending on the data to be inserted. only the amount of memory required to store the data is used. 2.Efficient insertion and deletion: insertion and deletion are efficient and take constant time as only the links are manipulated, not the actual memory location of the actual elements.

DISADVANTAGES OVER AN ARRAY 1.Slightly more memory usage: as each element has to store its data along with the reference information. 2. Sequential access; nodes in a linked list must be read in order from the beginning as linked list are inherently sequential access. 3.Difficult reverse traversal; difficulties arise In linked list when it comes to reverse traversing in a singly linked list. This can be resolved using doubly linked lists, but this again increase memory as we have to store the previous reference pointer.

ACCESSING AN ELEMENT IN A LINKED LIST An element in a linked list cannot be accessed directly, unlike an array. Thus, one has to traverse from one end of the linked list to the element that has to be accessed. This is what causes the average O(n) search and access time in a linked list. Insertion and deletion on the other hand is constant time as only a few pointers have to be modified

Uses of a linked list 1. Implement other data structures: It is used to implement other data structures such as stacks, queues and non-linear ones like trees and graphs. 2. Hash Chaining: It has uses in hash chaining for the implementation in open chaining.

Singly Linked List A singly list is the simplest type of linked list in which every node contains some data and a pointer to the next node. A singly linked list allows traversal of data only in one way.

Singly Linked List

Doubly Linked List A doubly linked list is a data structure which consists of nodes which have data, a pointer to the next node, and also a pointer to the previous node. Three ways of inserting a node in a doubly linked list in C++ are: Insertion of node at the front of the list. Insertion of node after a given node of the list.

Doubly Linked List

Circular Linked List In a circular linked list, the last node contains a pointer to the first node of the list, forming a loop. While traversing a circular linked list, we can begin at any node and traverse the list in any directions, forward or backward, until we reach the same mode we started. Thus, a circular linked list has no beginning and no ending.

Circular Linked List

THANK YOU! { } .. ..
Tags