Question 31
A doubly linked list is declared as
struct Node {
int Value;
struct Node *Fwd;
struct Node *Bwd;
);
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?
Question 32
Consider a singly linked list of the form where F is a pointer to the first element in the linked list and L is the pointer to the last element in the list. The time of which of the following operations depends on the length of the list?
Question 33
Consider the following ANSI C program:
#include < stdio.h >
#include < stdlib.h >
struct Node{
int value;
struct Node *next;};
int main( ) {
struct Node *boxE, *head, *boxN; int index=0;
boxE=head= (struct Node *) malloc(sizeof(struct Node));
head → value = index;
for (index =1; index<=3; index++){
boxN = (struct Node *) malloc (sizeof(struct Node));
boxE → next = boxN;
boxN → value = index;
boxE = boxN; }
for (index=0; index<=3; index++) {
printf(“Value at index %d is %d\\n”, index, head → value);
head = head → next;
printf(“Value at index %d is %d\\n”, index+1, head → value); } }
Which one of the following statements below is correct about the program?
Question 34
Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?
Question 35
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is (GATE CS 2002)
Question 36
Let P be a singly linked list. Let Q be the pointer to an intermediate node x in the list. What is the worst-case time complexity of the best known algorithm to delete the node Q from the list?
Question 37
What is the worst case time complexity of inserting n elements into an empty linked list, if the linked list needs to be maintained in sorted order ?
Question 38
Consider the following conditions:
(a)The solution must be feasible, i.e. it must satisfy all the supply and demand constraints.
(b)The number of positive allocations must be equal to m1n21, where m is the number of rows and n is the number of columns.
(c)All the positive allocations must be in independent positions.
The initial solution of a transportation problem is said to be non-degenerate basic feasible solution if it satisfies: Codes:
Question 39
Consider the following statements:
i. First-in-first out types of computations are efficiently supported by STACKS.
ii. Implementing LISTS on linked lists is more efficient than implementing LISTS on an array for almost all the basic LIST operations.
iii. Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array with two indices.
iv. Last-in-first-out type of computations are efficiently supported by QUEUES.
Which of the following is correct?
Question 40
Consider the problem of reversing a singly linked list. To take an example, given the linked list below,
the reversed linked list should look like
Which one of the following statements is TRUE about the time complexity of algorithms that solve the above problem in O(1) space?
There are 42 questions to complete.