A function defined on stacks of integers satisfies the following properties. and for all stacks and integers .If a stack contains the integers 2, -3, 2, -1, 2 in order from bottom to top, what is ?
GATE CSE · Programming In C
Practice problems for Stack in Programming in C.
31 questions · 11 PYQs · 0 AI practice · GATE CSE 2027
A function defined on stacks of integers satisfies the following properties. and for all stacks and integers .If a stack contains the integers 2, -3, 2, -1, 2 in order from bottom to top, what is ?
The best data structure to check whether an arithmetic expression has balanced parentheses is a
Assume that the operators +, -, x , are left associative and ^ is right associative. the order of precedence (from highest to lowest) is ^, x , +, -. The postfix expression corresponding to the infix expression a + b x c-d^e^f is
A program attempts to generate as many permutations as possible of the string, 'abcd' by pushing the characters a,b,c,d in the same order onto a stack, but it may pop off the top character at any time. Which one of the following strings CANNOT be generated using this program?
A single array A[1...MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top1 and top 2 (top1 top 2) point to the location of the topmost element in each of the stacks. If the space is to be used efficiently, the condition for "stack full" is
Let S be a stack of size n 1. Starting with the empty stack, suppose we push the first n natural numbers in sequence, and then perform n pop operations. Assume that Push and Pop operation take X seconds each , and Y seconds elapse between the end of the one such stack operation and the start of the next operation. For m 1, define the stack-life of m as the time elapsed from the end or Push (m) to the start of the pop operation that removes m from S . The average stack-life of an element of this stack is
To evaluate an expression without any embedded function calls
Which of the following is essential for converting an infix expression to the postfix form efficiently?
The postfix expression for the infix expression A+B*(C+D)/F+D*E is:
Which of the following permutations can be obtained in the output (in the same order) using a stack assuming that the input is the sequence 1, 2, 3, 4, 5 in that order?
Choose the correct alternatives (more than one may be correct) and write the corresponding letters only: The following sequence of operations is performed on a stack: PUSH (10), PUSH (20), POP, PUSH (10), PUSH (20), POP, POP, POP, PUSH (20), POP The sequence of values popped out is
Want unlimited AI-generated Stack questions?
Sign up free and practice with adaptive difficulty — Easy, Medium, Hard. New questions every session.
Start practising for free →