Linear Data Structures questions

Q13

GATE CS 2023 CSLinear Data StructuresMCQ1 mark−1/3 if wrong
Let SLLdel be a function that deletes a node in a singly-linked list given a pointer to the node and a pointer to the head of the list. Similarly, let DLLdel be another function that deletes a node in a doubly-linked list given a pointer to the node and a pointer to the head of the list.
Let nn denote the number of nodes in each of the linked lists. Which one of the following choices is TRUE about the worst-case time complexity of SLLdel and DLLdel?
Show answer without attempting

Answer: D

Q59

GATE CS 2023 CSLinear Data StructuresNAT2 marks
Consider a sequence aa of elements a0=1,a1=5,a2=7,a3=8,a4=9a_0 = 1, a_1 = 5, a_2 = 7, a_3 = 8, a_4 = 9, and a5=2a_5 = 2. The following operations are performed on a stack SS and a queue QQ, both of which are initially empty.

I: push the elements of aa from a0a_0 to a5a_5 in that order into SS.
II: enqueue the elements of aa from a0a_0 to a5a_5 in that order into QQ.
III: pop an element from SS.
IV: dequeue an element from QQ.
V: pop an element from SS.
VI: dequeue an element from QQ.
VII: dequeue an element from QQ and push the same element into SS.
VIII: Repeat operation VII three times.
IX: pop an element from SS.
X: pop an element from SS.

The top element of SS after executing the above operations is ____________.
Show answer without attempting

Answer: 8

0/20 correct0 marks

Related topics in Programming and Data Structures