3. Background
• Data Structure is a combination of two words: Data + Structure
“Why we need Data Structure?”
• Data Structures are necessary for designing efficient algorithms. Data structures
can help programmers to save a good amount of time while performing
operations such as storage, retrieval, or processing of data. Manipulation of large
amounts of data is easier.
An algorithm is simply a
set of steps used to
complete a specific task.
5. A linked list is a linear data structure, in which the elements
are not stored at contiguous memory locations. rather they are
linked using pointers.
Linked List forms a series of connected nodes, where each
node stores the data and the address of the next node.
What is Linked list?
The data structure in
which data elements are
arranged sequentially or
linearly
7. 1. It allocates the memory dynamically. All the nodes of linked list are
non-contiguously stored in the memory and linked together with the help
of pointers.
2. Adding or removing elements from a linked list is efficient, especially
for large lists.
3. Linked lists can be easily reorganized and modified without requiring a
contiguous block of memory.
The mechanism by which
storage/memory can be
allocated to variables during
the run time
9. Image viewer: Previous and next images are linked and can be accessed by
the next and previous buttons.
Previous and next page in a web browser: We can access the previous and
next URL searched in a web browser by pressing the back and next buttons
since they are linked as a linked list.
Music Player: Songs in the music player are linked to the previous and next
songs. So you can play songs either from starting or ending of the list.
File Systems: File systems use linked lists to represent the hierarchical
structure of directories, where each directory or file is represented as a node
in the list.
13. Operations Performed in
Linked List
Traversal: To traverse all the nodes
one after another.
Insertion: To add a node at the
given position.
Deletion: To delete a node.
Searching: To search an element(s)
by value.
Updating: To update a node.
15. Singly Linked List
Singly linked lists contain two
“buckets” in one node; one
bucket holds the data and the
other bucket holds the address
of the next node of the list.
Traversals can be done in one
direction only as there is only a
single link between two nodes of
the same list.
16. Insertion at beginning
Structure (also
called struct) is user
define data type that
contains many
different data types
(int, float, char, etc.).
19. Doubly Linked List
Doubly Linked List is a variation of
Linked list in which navigation is
possible in both ways, either forward
and backward easily as compared to
Single Linked List.
• Data − Each link of a linked list can
store a data called an element.
• Next − Each link of a linked list
contains a link to the next link called
Next.
• Prev − Each link of a linked list
contains a link to the previous link
called Prev.