A doubly linked list is declared as
C++
struct Node {
int Value;
struct Node *Fwd;
struct Node *Bwd;
);
C
// Struct definition in C
struct Node {
int Value;
struct Node *Fwd;
struct Node *Bwd;
};
Java
// Struct definition in Java
class Node {
int Value;
Node Fwd;
Node Bwd;
}
Python
# Class definition in Python
class Node:
def __init__(self, value):
self.Value = value
self.Fwd = None
self.Bwd = None
JavaScript
// Class definition in JavaScript
class Node {
constructor(value) {
this.Value = value;
this.Fwd = null;
this.Bwd = null;
}
}
Where Fwd and Bwd represent forward and backward link to the adjacent elements of the list. Which of the following segments of code deletes the node pointed to by X from the doubly linked list, if it is assumed that X points to neither the first nor the last node of the list?
X->Bwd->Fwd = X->Fwd; X->Fwd->Bwd = X->Bwd ;
X->Bwd.Fwd = X->Fwd ; X.Fwd->Bwd = X->Bwd ;
X.Bwd->Fwd = X.Bwd ; X->Fwd.Bwd = X.Bwd ;
X->Bwd->Fwd = X->Bwd ; X->Fwd->Bwd = X->Fwd;
A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let n denote the number of nodes in the queue. Let 'enqueue' be implemented by inserting a new node at the head, and 'dequeue' be implemented by deletion of a node from the tail.
Which one of the following is the time complexity of the most time-efficient implementation of 'enqueue' and 'dequeue, respectively, for this data structure?
In a doubly linked list, the number of pointers affected for an insertion operation will be
Consider an implementation of unsorted single linked list. Suppose it has its representation with a head and a tail pointer (i.e. pointers to the first and last nodes of the linked list). Given the representation, which of the following operation can not be implemented in O(1) time ?
Insertion at the front of the linked list.
Insertion at the end of the linked list.
Deletion of the front node of the linked list.
Deletion of the last node of the linked list.
Consider a single linked list where F and L are pointers to the first and last elements respectively of the linked list. The time for performing which of the given operations depends on the length of the linked list?
F->1->2->3->L
Delete the first element of the list
Interchange the first two elements of the list
Delete the last element of the list
Add an element at the end of the list
The following steps in a linked list
p = getnode()
info (p) = 10
next (p) = list
list = p
result in which type of operation?
inserting a node at beginning
modifying an existing node
In DNA sequence alignment, which string-matching algorithm is commonly used to identify similarities between two DNA sequences efficiently?
Knuth-Morris-Pratt algorithm
Which of the following operations is performed more efficiently by doubly linked list than by linear linked list?
Deleting a node whose location is given
Searching an unsorted list for a given item
Inserting a node after the node with a given location
Traversing the list to process each node
The time required to search an element in a linked list of length n is
The minimum number of fields with each node of doubly linked list is
There are 39 questions to complete.
Take a part in the ongoing discussion
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4