answersLogoWhite

0

Stack operations in pseudo-code:

STACK-EMPTY(S)
if top[S] = 0
return true
else return false

PUSH(S, x)
top[S] <- top[S] + 1
S[top[S]] <- x

POP(S)
if STACK-EMPTY(S)
then error "underflow"
else top[S] <- top[S] - 1
return S[top[S] + 1]

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Write a c program to perform stack operation?

int top=-1; int stack[10];


How to write pseudocode in Microsoft Word?

To write pseudocode in Microsoft Word, you can use the built-in Equation Editor or insert a text box and type your pseudocode inside it. You can also use a monospaced font like Courier New to format your pseudocode for better readability.


write a pseudocode to accept a number and find if it is prime or not?

Yes


How do you write a pseudocode with conditions?

Start Input x, y ; If (x


Write the Pseudocode to find the factorial of a number?

Pseudo code+factorial


How do you write a pseudocode program for finding out x to the power of y?

X**y


'write a simple program for stack operation in c plus plus?

void push(int y) { if(top&gt;stackSize) { cout&lt;&lt;"stack full"&lt;&lt;endl; return; } else { top++; stack[top]=y; } } int pop() { int a; if(top&lt;=0) { cout&lt;&lt;"stack is empty"&lt;&lt;endl; return 0; } else { a=stack[top]; top--; } return(a); }


Explain Pseudo code for circular linked list?

write pseudocode for link list


Write a pseudocode statement that assigns the value 27 to the variable count?

count := 27


How do you write the semicolon symbol in a pseudocode logic program delaing with classes?

Any of these: PRINT semicolon EMIT ; WRITE ";" etc.


How to write an algorithm in pseudocode effectively?

To write an algorithm in pseudocode effectively, start by clearly defining the problem and breaking it down into smaller steps. Use descriptive variable names and comments to explain each step. Test your algorithm with different inputs to ensure it works correctly. Keep the pseudocode simple and easy to understand for others who may read it.


Write a sequence of instruction to exchange two register contents using stack in 8086 processor?

To exchange two registers, say the BX and CX registers, in the 8086 using the stack, you can use...PUSH BXPUSH CXPOP BXPOP CX... Of course, this is for 16 bit operation. If you want 8 bit operation, you will need to do more than that, because stack operations are always 16-bit operations.