0% found this document useful (0 votes)
27 views

CSS 433 GROUP 3 Edited

The document discusses ring structures (circular linked lists) versus doubly linked lists. It defines each type of linked list and describes their basic operations, advantages, disadvantages and applications. Ring structures form a circle with the first and last nodes connected, while doubly linked lists connect each node to the next and previous nodes.

Uploaded by

Kenny Atu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

CSS 433 GROUP 3 Edited

The document discusses ring structures (circular linked lists) versus doubly linked lists. It defines each type of linked list and describes their basic operations, advantages, disadvantages and applications. Ring structures form a circle with the first and last nodes connected, while doubly linked lists connect each node to the next and previous nodes.

Uploaded by

Kenny Atu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

CSS 433 GROUP 3

RING STRUCTURES VERSUS DOUBLY LINKED LISTS

Anigbogu Chukwudi Anthony

Aribisala Oyinkansola Ololade

Atu Kenechukwu Gospel

Ayantade Demilade Enoch

Ayoola Ooreoluwa John

Ayuba Ebenezer Akinola

Babalola Opeoluwa Ayomide

Babatunde Oluwatobiloba Oladipupo

Bamiboje Mofijifolouwa

Bamtefa Oluwatodimu Ijinleife


WHAT IS A LINKED LIST

A linked list is a linear collection of data elements whose order is not given
by their physical placement in memory. Instead, each element points to the
next.

It is a data structure consisting of a collection of nodes which together


represent a sequence. In its most basic form, each node contains: data,
and a link to the next node in the sequence.
This structure allows for efficient insertion or removal of elements from any
position in the sequence during iteration.

The addition of additional links in more complex variants enables the more
effective insertion or removal of nodes at any location. The linear access
time of linked lists is a disadvantage (and difficult to pipeline).
Faster access, such as random access, is not feasible. Arrays have better
cache locality compared to linked lists.
TYPES OF LISTS

There are three common types of Linked Lists. And they include;

 Singly Linked List


 Doubly Linked List
 Circular Linked List (Also Known as ring structures)

For the sake of this study, we will center focus on just the Circular and
Doubly linked list

RING STRUCTURES (CIRCULARLY LINKED LISTS)

A circularly linked list is a type of linked list where the first node and the last
node are connected to form a circle. It can also be referred to as a
sequence of nodes such that each node can be retraced to itself with no
NULL at the end. A "node" in this context is a self-referential element with
pointers to one or two other nodes nearby.
Basic Circular Linked List Operations

Below are the basic operations that can be performed on a circular linked
list:
1. Insertion : Inserts a node at the start of the list
2. Deletion: Deletes a node at the start of the list
3. Display: Displays the list

Insertion in the circular linked list:


A node can be added in three ways:

Insertion at the beginning of the list


Insertion at the end of the list
Insertion in between the nodes

Insertion at the beginning of the list

 Create a node, T.
 Make T -> next = last -> next: here we update the next part of the
new node so that it can point to the last node
 last -> next = T: and lastly we update the next part of the last node so
that it can point to T
Circular linked list before insertion

And then,

Circular linked list after insertion


Insertion at the end of the list

Insertion at the end of the list: To insert a node at the end of the list, follow
these steps:
 Create a node, say T.
 Make T -> next = last -> next;
 last -> next = T.
 last = T.
Before insertion,

Circular linked list before insertion of node at the end

After insertion,

Circular linked list after insertion of node at the end


Insertion in between the nodes
To insert a node in between the two nodes, follow these steps:
 Create a node, say T.
 Search for the node after which T needs to be inserted, say
that node is P.
 Make T -> next = P -> next;
 P -> next = T.
Suppose 12 needs to be inserted after the node has the value 10,

Circular linked list before insertion

After searching and insertion,

Circular linked list after insertion


Types of Circularly Linked Lists

1. Circular Singly Linked List: In a circular singly linked list, the address
of the last node consists of the address of the first node. We traverse a
circular singly linked list until we reach the same node that we started from.

The circular singly linked list has no beginning or end and no null value is
present in the next part of any of the nodes.
2. Circular Doubly Linked List: for a circular doubly linked list, in addition
to the last node storing the address of the first node, the first node will also
store the address of the last node. Circular Doubly Linked List has
properties of both doubly linked list and circular linked list in which two
consecutive elements are linked or connected by the previous and next
pointer and the last node points to the first node by the next pointer and
also the first node points to the last node by the previous pointer.
Advantages of Circular Linked Lists

1. From the last node, or the head node, one can travel back to the first.
2. The starting node is irrelevant because we can traverse all nodes
regardless of which node we choose to start at.
3. The previous node is clearly visible.
4. A NULL function is not required in the code. Unless it is fully
assigned, a NULL identifier is never identified by the circular list.
5. Online queues can be successfully finished by algorithms like Round
Robin setup without having to deal with NULL suspension or
reference references.

Disadvantages of Circular Linked Lists

1. The circular nature of the circular linked list can result in an infinite
loop if it is not handled properly.
2. We must traverse the entire list after inserting at the start in order to
locate the final node.
3. It is not possible to access elements directly.
4. Reversing a circular linked list is generally a challenging task.

Applications of Circular Linked Lists

1. Round Robin scheduling in system processes and circular scheduling


in high-speed graphics.
2. It is used in display units like shop boards that require continuous
traversal of data.
3. Audio/Video Streaming
4. Circular Escalators

DOUBLY LINKED LISTS

What is a doubly linked list ?

Each node in a "doubly linked list" has a second link field that points to the
node that comes before it in the sequence in addition to the next-node link.
The two links could be referred to as "forward" and "backwards" or "next"
and "prev" (or "previous"). A doubly linked list is bidirectional and can be
traversed in both directions

Structure of a doubly linked list

A doubly linked list of singly linked lists is a data structure composed of a


set of singly linked lists (SLLs) which are all doubly linked. It is utilized to
store data in a manner that allows for quick element addition and removal.

Every SLL is composed of a head and a tail. A pointer to the first element is
located at the head of each SLL, and a pointer to the last element is
located at the tail.

Because it allows for quick element insertion and deletion, it has an


advantage over other data structures. It is easy to implement and has a
wide range of applications.
Memory representation of a Doubly linked list

Basic Operations
The basic operations supported by a list are as follows.

● Insertion − Inserts an element at the beginning of the list.


● Deletion − Removes an element from the beginning of the list.

● Insert Last − Inserts an element at the end of the list.

● Delete Last − Deletes an element from the end of the list.

● Insert After − Inserts an element after an item of the list.

● Delete − Deletes an element from the list using the key.

● Display forward − Displays the complete list in a forward manner.

● Display backward − Displays the complete list in a backward manner.

Advantages of Doubly Linked Lists

1. A DLL can be walked through both forward and backward.


2. Before a specific node, a new node can be added quickly.
3. If a pointer to the node that needs to be deleted is provided, the
delete operation in DLL is more effective.
4. A pointer to the preceding node is required in a singly linked list in
order to delete a node. Sometimes the list is traversed to obtain this
previous node. Using the previous pointer in DLL, we can retrieve the
previous node.

Disadvantages of Doubly Linked Lists

1. Every DLL node needs additional space for a prior pointer.


2. An additional previous pointer must be preserved for all operations.
For instance, when doing insertion, we must adjust both the
preceding and subsequent pointers.

Applications of Doubly Linked Lists


1. It is used in the navigation systems where front and back navigation
is required.
2. It is used by the browser to implement backward and forward
navigation of visited web pages that is a back and forward button.
3. It is also used by various applications to implement undo and redo
functionality.
4. Doubly Linked List is also used in constructing MRU/LRU (Most/least
recently used) cache.
5. Other data structures like stacks, Hash Tables, Binary trees can also
be constructed or programmed using a doubly-linked list.

RING STRUCTURES (CIRCULAR LINKED LISTS) VS DOUBLY


LINKED LISTS
CIRCULAR LINKED LISTS DOUBLY LINKED LISTS
The first and last nodes are The first and last nodes are not
connected to form a circle connected to each other
Any node may serve as the initial To navigate the list, a specific start
node. The entire list can be node is used.
traversed by beginning at any
location. Once the initial visited
node is visited a second time, we
only need to stop.
Does not contain a null pointer in First and Last nodes contains a null
any of the nodes pointer

Has its applications in Circular Has its applications in


scheduling , Audio/Video
streaming and so on

You might also like