Data Structures & AlgorithmsEasyWipro · Accenture pattern
Which data structure works on the Last In, First Out (LIFO) principle?
- A. Queue
- B. Stack
- C. Priority queue
- D. Hash table
Correct answer: B. Stack
A stack removes the most recently pushed item first (LIFO). A queue is FIFO, and a priority queue removes by priority, not by arrival order.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- What is the worst-case time complexity of binary search on a sorted array of n elements?
- Which of these sorting algorithms is stable in its standard implementation?
- What is the time complexity of inserting a new node at the head of a singly linked list of n nodes?
- With a good hash function and a bounded load factor, what is the average time to search for a key in a hash table?
- What is the postfix form of the infix expression A + B C?
- What is the value of the postfix expression 6 2 3 + − 3 8 2 / + ?