answersLogoWhite

0

This is not possible as this violates the basic definition of stack...That can have only two primitive operations "Push" "POP"

If u want to implement what u want u can do that by some implementation of Push pop combination but that is what other data strutures like queue do....

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What are the stack operation?

there are two operations you can do with a STACK one is PUSH operation and the other is POP operation


What is time complexity of stack?

All major queue operations (push, pop and front) are constant time operations.


What are some common operations that can be performed on a stack data structure?

Common operations that can be performed on a stack data structure include push (adding an element to the top of the stack), pop (removing the top element from the stack), peek (viewing the top element without removing it), and isEmpty (checking if the stack is empty).


What is Push and pops?

Push and pop relate to sequence containers where elements can be inserted and removed from the sequence with push and pop operations, respectively. Typically, push and pop apply to one end of the sequence, but not necessarily at the same end. However, if a push or a pop can be applied to both ends of a sequence, the operations are named push_front, push_back, pop_front and pop_back. Ideally, push and pop are constant-time operations. However, depending on the container type, a push or pop at one end may be more efficient than at the other. The following is a summary of common container types and the efficiencies that can be expected: A vector supports push and pop at either end. However, push_back and pop_back are constant time operations unless a reallocation occurs (we can reserve memory at the end of the vector to minimise the need for reallocations) whereas push_front and pop_front are always linear-time operations. A forward list supports push and pop at the head of the list only, both of which are constant-time operations. A bi-directional list supports push and pop at either end, all of which are constant-time operations. A queue supports push at the back and pop at the front, both of which are constant-time operations. A deque (double-ended-queue) supports push and pop at either end, all of which are constant-time operations. A stack supports push and pop at the top of the stack, both of which are constant time operations. Note that a fixed-length array does not support push or pop operations because it cannot grow or shrink in size.


What is interface stack?

The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with five operations that allow a vector to be treated as a stack. The usual push and pop operations are provided, as well as a method to peek at the top item on the stack, a method to test for whether the stack is empty, and a method to search the stack for an item and discover how far it is from the top.


What is push operation in data structure?

Push inserts a value onto the top of the stack. Pop extracts the top value from the stack. These are the two primary operations that can be performed upon a stack. Prior to popping a value, you will first check the stack is not empty, store the top value, then pop the stack. For a stack of type T, you might use the following: if (!stack.empty()) { T value {stack.top()}; // copy top value stack.pop(); // remove value from stack // use value... }


What is a stack and how do you represent a stack in computer memory also discuss basic operation performed on a stack?

A stack is an abstraction of First-in-last-out, or the last in first out. The basic operations (may bear different names) Push or Add Pop or Next


When will stack overflow and stack underflow condition occur insequential organization?

In a sequential organization, a stack overflow condition occurs when there is an attempt to push an element onto a stack that is already full, exceeding its allocated memory limit. Conversely, a stack underflow condition occurs when there is an attempt to pop an element from an empty stack, which has no elements to remove. Both conditions can lead to runtime errors and need to be handled to maintain the integrity of the stack operations. Proper checks should be implemented to prevent these situations.


What is it called when forces push on both sides of an object?

Compression.


What do you mean by stack explain the push or pop operation?

A stack is a linear data structure that follows the Last In, First Out (LIFO) principle, meaning the last element added is the first one to be removed. The "push" operation adds an element to the top of the stack, while the "pop" operation removes the element from the top. Both operations are typically performed in constant time, O(1), making stacks efficient for various applications, such as function call management and expression evaluation in programming.


How stack pointer registers are involved in the execution of push and pop instruction?

If the stack is empty assume the stack pointer has a value of P. when you push something on the stack you increment P. when you pull something from stack you decrement P.


What does pop stand for in internet slang?

In computing, PUSH and POP refer to the principal operations with a stack data structure, where pushadds a new item on the top of the stack and pop removes an item from the top of the stack.