GATEverse
← GATE CSE 2025 Set 2

Q35

MCQ2 marks, −0.67

Consider a stack data structure into which we can PUSH and POP records. Assume that each record pushed in the stack has a positive integer key and that all keys are distinct. We wish to augment the stack data structure with an O(1)O(1) time MIN operation that returns a pointer to the record with smallest key present in the stack Which one or more of the following approach(es) can achieve it? Keep with every record in the stack, a pointer to the record with the smallest key below it. Keep a pointer to the record with the smallest key in the stack. Keep an auxiliary array in which the key values of the records in the stack are maintained in sorted order. Keep a Min-Heap in which the key values of the records in the stack are maintained.

Sign in to save attempts.

Loading…