Interview Questions on Linked Lists in Data Structures Set 3

Linked Lists interview questions for beginners. Answers to all of them have been provided. This is subjective type short answers question and answer set no. 3 in this series.

Last Reviewed and Updated on February 7, 2020
Posted by Parveen(Hoven),
Aptitude Trainer and Software Developer

Interview and Exam Questions and Answers

This set contains a list of commonly asked questions. They are short interview questions aimed at freshers interview, campus placement drives, and also for job interviews. You can use these to have a quick grasp and brush-up of your fundamentals. These questions can be viewed on a mobile phone also because this website is built on responsive web design.

What operations are implemented in a linked list?

Various operations implemented on a linked list are insert, delete, traverse and search.

How do you define singly-linked list?

Singly linked lists contain nodes which have a data field as well as a next field, which points to the next node in the linked list.

A singly linked list whose nodes contain two fields: an integer value and a link to the next node.

Draw the structure of a linked list.

first part represent data and second part represent address of next node

Draw the structure of a linked list.

first part represent data and second part represent address of next node

Write an algorithm for inserting a node at the beginning of the circular-linked list, when the list is not empty.

If the list is not empty, the following algorithm is used to insert a node in the linked list.

  1. Allocate a memory for a new node.
  2. Assign a value to the data field of the new node.
  3. Make the next field of new node point to the successor of LAST.
  4. Make the next field of LAST point to new node.

Write an algorithm for inserting a node in a Singly-Linked list, if list is empty .

  1. Allocate memory for the new node.
  2. Assign a value to the data field of the new node.
  3. Make the next field of the new node point to NULL.
  4. Make START point to the new node

Write algorithm for inserting node at the beginning of Singly-Linked list, if list is not empty .

To insert a node at the beginning of the linked list algorithm is:

  1. Allocate memory for the new node.
  2. Assign value to the data field of the new node.
  3. Make the next field of the new node point to the first node in the list.
  4. Make START point to the new node.

How does the representation of a node in a doubly-linked list differ from that in a singly-linked list?

Unlike singly-linked list, in which each node stores the address of only the next node in the list, each node in a doubly-linked list holds the address of its previous node also.

What are different types of linked list?

Singly-linked list, Doubly-linked list and Circular linked list

Write an algorithm to insert a node between two nodes in the list, when the list is not empty.

If the list is not empty, the following algorithm is used to insert a node between two nodes in the linked list.

  1. Identify the nodes between which th new node is to be inserted. Mark them as previous and current. To locate previous and current, execute the following steps:
    1. Make current point to the first node.
    2. Make previous point to NULL.
    3. Repeat step d and e until current.info>newnode.info or previous=LAST
    4. Make previous point to current.
    5. Make current point to the next node in sequence.
  2. Allocate a memory fo new node.
  3. Assign a value to the data field of the new node.
  4. Make the next field of new node point to current.
  5. Make the next field of previous point to the new node.

My C/C++ Videos on Youtube

Here is the complete playlist for video lectures and tutorials for the absolute beginners. The language has been kept simple so that anybody can easily understand them. I have avoided complex jargon in these videos.