Linear Data Structures questions

Q15

GATE CS 2022 CSLinear Data StructuresMCQ1 mark−1/3 if wrong
Consider the problem of reversing a singly linked list. To take an example, given the linked list below,

head -> [a] -> [b] -> [c] -> [d] -> [e] -> NULL

the reversed linked list should look like

head -> [e] -> [d] -> [c] -> [b] -> [a] -> NULL

Which one of the following statements is TRUE about the time complexity of algorithms that solve the above problem in O(1)O(1) space?
Show answer without attempting

Answer: A

Q62

GATE CS 2022 CSLinear Data StructuresNAT2 marks
Consider the queues Q1Q_1 containing four elements and Q2Q_2 containing none (shown as the Initial State in the figure). The only operations allowed on these two queues are Enqueue(Q, element) and Dequeue(Q). The minimum number of Enqueue operations on Q1Q_1 required to place the elements of Q1Q_1 in Q2Q_2 in reverse order (shown as the Final State in the figure) without using any additional storage is___________.
Question figure
Show answer without attempting

Answer: 0

0/20 correct0 marks

Related topics in Programming and Data Structures