Linear Data Structures questions

Q8

GATE CS 2017 CS-1Linear Data StructuresMCQ1 mark−1/3 if wrong
Consider the C code fragment given below.
typedef struct node {
    int data;
    node* next;
} node;

void join(node* m, node* n) {
    node* p = n;
    while (p->next != NULL) {
        p = p->next;
    }
    p->next = m;
}
Assuming that mm and nn point to valid NULL-terminated linked lists, invocation of join will
Show answer without attempting

Answer: B

Q13

GATE CS 2017 CS-2Linear Data StructuresMCQ1 mark−1/3 if wrong
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and REAR pointing to the front node and the rear node of the queue, respectively. Which of the following statements is/are CORRECT for such a circular queue, so that insertion and deletion operations can be performed in O(1)O(1) time?

I. Next pointer of front node points to the rear node.
II. Next pointer of rear node points to the front node.
Show answer without attempting

Answer: B

0/20 correct0 marks

Related topics in Programming and Data Structures