COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
can be added to any position and removed only from the top
|
|
can be only added to the top and removed from any position
|
|
can be added and removed from the top only
|
|
can be added and removed from any position
|
Detailed explanation-1: -It means insertion and deletion in the stack data structure can be done only from the top of the stack. You can access only the top of the stack at any given point in time. Inserting a new element in the stack is termed a push operation. Removing or deleting elements from the stack is termed pop operation.
Detailed explanation-2: -The order in which an element added to or removed from a stack is described as last in, first out, referred to by the acronym LIFO.
Detailed explanation-3: -A stack is an ordered list in which all insertions and deletions are made at one end, called the top. A queue is an ordered list in which all insertions take place at one end, the rear, while all deletions take place at the other end, the front.
Detailed explanation-4: -Deletion of an element from the top of the stack is called pop operation. The value of the variable top will be incremented by 1 whenever an item is deleted from the stack.
Detailed explanation-5: -Dequeue (double-ended queues) are the refined queues in which elements can be added or removed at either end but not in the middle.