wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Identify the steps to be taken when a first node is deleted from linked list.
(i) set link of start pointer to be second node in the list
(ii) free the space associated with first node
(iii) obtain the address of the second node in the list.

A
i and ii
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
i, ii and iii
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
ii and iii
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
i, ii, iii, iv
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is B i, ii and iii

The steps to be taken when a first node is deleted from linked list:-
1) Set link of start pointer to be second node in the list.
2) Free the space associated with first node.

Linked list:-

A linked list is a linear data structure where each element is a separate object. Each element of a list is comprising of two items - the data and a reference to the next node. The last node has a reference to null. The entry point into a linked list is called the head of the list.

We explicitly handle the case when node to be deleted is first node, we copy the data of next node to head and delete the next node. The cases when deleted node is not the head node can be handled normally by finding the previous node and changing next of previous node.



925518_916725_ans_cc1f5b80b608492987cfc72dc0224342.PNG

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Graphical Representation of Data
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon