Question 21
S1 : Anyone of the followings can be used to declare a node for a singly linked list. If we use the first declaration, “struct node * nodePtr;” would be used to declare pointer to a node. If we use the second declaration, “NODEPTR nodePtr;” can be used to declare pointer to a node.
/* First declaration */
struct node {
int data;
struct node * nextPtr;
};
/* Second declaration */
typedef struct node{
int data;
NODEPTR nextPtr;
} * NODEPTR;
S2 : Anyone of the following can be used to declare a node for a singly linked list and “NODEPTR nodePtr;” can be used to declare pointer to a node using any of the following
/* First declaration */
typedef struct node
{
int data;
struct node *nextPtr;
}* NODEPTR;
/* Second declaration */
struct node
{
int data;
struct node * nextPtr;
};
typedef struct node * NODEPTR;
Question 22
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.
head->1->2->3->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?
Question 23
In a doubly linked list, the number of pointers affected for an insertion operation will be
Question 24
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 ?
Question 25
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
Question 26
The following steps in a linked list
p = getnode()
info (p) = 10
next (p) = list
list = p
result in which type of operation?
Question 27
In DNA sequence alignment, which string-matching algorithm is commonly used to identify similarities between two DNA sequences efficiently?
Question 28
Which of the following operations is performed more efficiently by doubly linked list than by linear linked list?
There are 42 questions to complete.