 Scaler
Practice
Resources
Contests
Online IDE
New
Free Mock ## Welcome to Interviewbit, help us create the best experience for you!

Currently, You are a: College/University *
Enter the name of your college
Branch *
Year of completion * College/University *
Enter the name of your college
Branch *
Year of completion * Current Company *
Enter company name
Experience * ## You're all set! Full name *
Email *

By creating an account, I acknowledge that I have read and agree to InterviewBit’s Terms and Privacy Policy . ## Welcome back!

Email *

LinkedList is a linear data structure like arrays. In a Linked List each element is actually a separate object linked to the next element using a reference stored in a pointer.

A Linked List is composed of nodes, which are connected to the next node, using memory references or addresses. A Linked List node usually contains 2 properties stored in it. They are:

1. The value to be stored in the current node.
2. The reference or address of the next node, or NULL if it is the last node.

Linked Lists are of 2 types usually:

1. Singly Linked Lists: They are the standard linked list, where the value of the current node and the reference of the next node is only stored. The reference stored in the last node of the list is NULL.
2. Doubly Linked Lists: This type of linked list stores all the information of the Singly Linked Lists, along with the reference or memory address of the previous node too if it exists, else NULL.

Useful Resources

1.

Which of the following information is stored in a doubly-linked list’s nodes?

2.

What is the optimal time complexity to count the number of nodes in a linked list?

3.

What will be the output of the following code snippet for the list 1->2->3->4->5->6?

``````void solve(struct node* start)
{
if(start == NULL)
return;
printf("%d ", start->data);
if(start->next != NULL )
solve(start->next->next);
printf("%d ", start->data);
}``````
4.

Which of the following are applications of linked lists?

5.

Insertion of an element at the middle of a linked list requires the modification of how many pointers?

6.

Insertion of an element at the ends of a linked list requires the modification of how many pointers?

7.

In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element will be?

8.

Which of the following algorithms is not feasible to implement in a linked list?

9.

What will be the value of “sum” after the following code snippet terminates?

``````void solve(ListNode* root) {
/*
root-> val = value of the node
root-> next = address of next element from the node
The List is 1 -> 2 -> 3 -> 4 -> 5
*/
int sum = 0;
while(root -> next != NULL) {
sum += root -> val;
root = root -> next;
}
cout << sum << endl;
}``````
10.

Which of the following can be done with LinkedList?

11.

What is the time complexity to insert an element to the front of a LinkedList(head pointer given)?

12.

What is the time complexity to insert an element to the rear of a LinkedList(head pointer given)?

13.

A linked list node can be implemented using?

14.

Which type of linked list stores the address of the head node in the next pointer of the last node?

15.

Polynomial addition can be implemented using which of the following datastructure?

16.

What does the following code snippet do?

``````ListNode* solve(ListNode* head) {
ListNode* prev = NULL;
}
if(head -> next == NULL) {
}
ListNode* curr = head -> next;
if(curr != NULL) {
curr = curr -> next;
}
}
return prev;
}``````
17.

What is the time complexity of a program to reverse a linked list?

18.

Concatenation of 2 linked list will take a time complexity of?

19.

In which type of linked lists traversals can be performed in both directions?

20.

Which of the following algorithm is the optimal way to find the middle element of the linked list?

21.

A linked list in which none of the nodes contains a NULL pointer is?

22.

Which of the following statements are true?

23.

What is the optimal complexity we can achieve when removing duplicates from an unsorted linked list?

24.

What is the optimal complexity we can achieve when removing duplicates from an sorted linked list?

25.

Which of the following sorting algorithms can be applied to linked lists?

26.

What does the following code snippet do?

``````ListNode* solve(ListNode* head, int x) {
int count = 1;
while(front != NULL) {
cout << front -> data << " " << head -> data << endl;
if(count <= x) {
front = front -> next;
}
else {
front = front -> next;
}
count++;
}
}``````
27.

What will be the output of the following code snippet for 1->2->3->4->5?

``````void solve (ListNode* head) {
cout << head -> data << " ";
}
}``````
28.

The type of pointer used to point to the address of the next element in a linked list?

29.

What does the following code snippet do?

``````int solve (ListNode* list) {
ListNode* fast = list;
ListNode* slow = list;
while(fast -> next != NULL && fast -> next -> next != NULL) {
fast = fast -> next -> next;
slow = slow -> next;
}
return slow -> data;
}``````
30.

Which of the following is optimal to find an element at kth position at the linked list?

31.

What does the following code snippet do?

``````void solve(ListNode* node) {
node = node -> next;
}``````
32.

What is the time complexity of adding 2 numbers as a linked list?

33.

Which of the following problems can be solved using 2 pointers on linked list?

34.

Which of the following is similar about singly and doubly linked list?

35.

Rotating a linked list by some places clockwise will take a time complexity of?

36.

Rotating a linked list by some places clockwise will take a space complexity of?

37.

The time complexity of enqueue operation of a queue implemented by a singly linked list is?

38.

The time complexity of dequeue operation of a queue implemented by a singly linked list is?

39.

Which data structure is used in a compiler for managing information about variables and their attributes?

40.

Polynomial addition is implemented using which data structure?

41.

In a circular linked list insertion of a record requires the modification of?

42.

Consider the following code snippet:

``````struct node
{
int data;
struct node * next;
}
typedef struct node NODE;
NODE *ptr;``````

How can we create a new node?

43.

How can we destroy a pointer in C++?

44.

Which of the following statements are true?

45.

What is the space complexity for deleting a linked list?

46.

What is the space complexity needed to store a linked list of n nodes?

47.

Which of the following linked list operation takes O(1) time?

48.

What are the information stored by linked lists which are used to implement binary trees?

49.

Which of the following variations of linked lists can we use to search a sorted list in better than amortized O(n) complexity?

50.

Which of the following sorting algorithms is preferred to sort a linked list?

Get Placed at Top Product Companies with Scaler Know More
Get Placed at Top Product Companies with Scaler Know More
Get Placed at Top Product Companies with Scaler  Personalised feedback report with solutions Real life Interview Questions Identify exact topics to improve

Your feedback is important to help us improve. Free Mock Assessment
Help us know you better for the best experience
Current Employer *
Enter company name