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

03-module-05

The document discusses the drawbacks of using sequential storage for arrays, such as fixed allocation and overflow risks. It introduces linear linked lists as an alternative, where each node contains data and a pointer to the next node, allowing for dynamic insertion and removal of elements. The document also explains the structure of linked lists, including the concept of an empty list and the use of null pointers.

Uploaded by

Athish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

03-module-05

The document discusses the drawbacks of using sequential storage for arrays, such as fixed allocation and overflow risks. It introduces linear linked lists as an alternative, where each node contains data and a pointer to the next node, allowing for dynamic insertion and removal of elements. The document also explains the structure of linked lists, including the concept of an empty list and the use of null pointers.

Uploaded by

Athish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Vidyalankar : GATE – CS

LINKED LISTS

There are certain drawbacks of using sequential storage to represent arrays.


i) A fixed amount of storage remains allocated to the array even when the structure
is actually using a smaller amount or possibly no storage at all.
ii) Only fixed amount of storage may be allocated, making overflow a possibility.

In a sequential representation, the items of an array are implicitly ordered by the


sequential order of storage. If arr[x] represents an element of an array, the next
element will be arr[x + 1]

Suppose that the items of an array were explicitly ordered i.e. each item contained
within itself the address of the next element. Such an explicit ordering gives rise to a
data structure known as a Linear linked list as shown in the figure below.

Fig.1: Linear linked list

Each item in the list is called a node and it contains two fields.
i) Information field: It holds the actual element on the list.
ii) The next address field: It contains the address of the next node in the list.
Such an address, which is used to access a particular node, is known as a
pointer.

The entire linked list is accessed from an external pointer list that points to
(contains the address of) the first node in the list.

The next address field of the last node in the list contains a special value called
null. This is not a valid address and is used to signal the end of a list.

The list with no nodes on it is called the empty list or the null list. The value of the
external pointer list to such a list is the null pointer. A list can be initialized to the
empty list by the operation list = null.

INSERTING AND REMOVING NODES FROM A LIST


Insertion
A list is a dynamic data structure. The number of nodes on a list may vary as elements
are inserted and removed. The dynamic nature of a list may be contrasted with the static
nature of an array, whose size remains constant.

GATE/CS/DSA/SLP/Ch.1_Notes/Pg.2

You might also like