search
Log In

Recent questions tagged stack

0 votes
2 answers
1
Consider the following sequence of operations on an empty stack. $\textsf{push}(54);\textsf{push}(52);\textsf{pop}();\textsf{push}(55);\textsf{push}(62);\textsf{s}=\textsf{pop}();$ ... $\textsf{s+q}$ is ___________.
asked Feb 18 in DS Arjun 443 views
1 vote
2 answers
2
1 vote
1 answer
3
2 votes
2 answers
4
In the ________ traversal we process all of a vertex's descendants before we move to an adjacent vertex. Depth First Breadth First Width First Depth Limited
asked Mar 31, 2020 in DS Lakshman Patel RJIT 741 views
1 vote
2 answers
5
Assume that the operators $+,-,\times$ are left associative and $\wedge$ is right associative. The order of precedence(from highest to lowest) is $\wedge,\times, +,-$. The postfix expression corresponding to the infix expression $a+b\times c-d\wedge e\wedge f$ is $abc\times+def\wedge\wedge-$ $abc\times+de\wedge f\wedge-$ $ab+c\times d-e\wedge f\wedge $ $-+a\times bc\wedge\wedge def$
asked Mar 30, 2020 in DS Lakshman Patel RJIT 273 views
1 vote
2 answers
6
The seven elements $A, B, C, D, E,F$ and $G$ are pushed onto a stack in reverse order, i.e., starting from $G$. The stack is popped five times and each element is inserted into a queue. Two elements are deleted from the queue and pushed back onto the stack. Now, one element is popped from the stack. The popped item is ___________. $A$ $B$ $F$ $G$
asked Mar 24, 2020 in DS jothee 338 views
3 votes
3 answers
7
A stack is implemented with an array of $'A[0...N-1]'$ and a variable $pos$'. The push and pop operations are defined by the following code. push (x) A[pos] <- x pos <- pos -1 end push pop() pos <- pos+1 return A[pos] end pop Which of the ... initialize an empty stack with capacity $N$ for the above implementation $pos \leftarrow -1$ $pos\leftarrow 0$ $pos\leftarrow 1$ $pos\leftarrow N-1$
asked Jan 13, 2020 in DS Satbir 718 views
4 votes
2 answers
8
1 vote
1 answer
9
Explain how to implement two stacks in one array $A[1...n]$ in such a way that neither stack overflows unless the total number of elements in both stacks together is $n$.The $PUSH$ and $POP$ operations should run in $O(1)$ time.
asked Jun 28, 2019 in Algorithms akash.dinkar12 231 views
1 vote
1 answer
10
STACK-EMPTY(S) 1 if S.top == 0 2 return TRUE 3 else return FALSE PUSH(S , x) 1 S.top = S.top + 1 2 S[S.top] = x POP(S) 1 if STACK-EMPTY(S) 2 error “underflow” 3 else S.top = S.top – 1 4 return S[S.top + 1] illustrate the result of each operation in the sequence $PUSH(S,4), PUSH(S,1),PUSH(S,3),POP(S),PUSH(S,8),POP(S)$ on an initially empty stack $S$ stored in array $S[1...6]$
asked Jun 28, 2019 in Algorithms akash.dinkar12 142 views
1 vote
1 answer
11
A stack based CPU executes the instruction. Memory location $500$ contain $0X 88$ and memory location $700$ contain $0X37$. The stack pointer is at $0X003F$ The instruction are as follows: $I_{1}:PUSH$ $500$ $I_{2}:PUSH$. $700$ $I_{3}:ADD$ $I_{4}:POP$ ... $0X88$ after execution of instruction. $C)$ Memory location $600$ contain $0XBF$ after execution of instruction. $D)$ Both $a)$ and $c)$
asked May 22, 2019 in DS srestha 348 views
2 votes
2 answers
12
There is given a infix expression: ${\color{Red} {1}}$ $A+B\times C/\left ( \left ( D+E \right )+F\times G \right )$ While converting infix expression to postfix expression number of symbols in the stack at indicated ${\color{Red} {point-1}}$ infix expression (assume stack is initially empty) ______________ they told $5$, but is it correct? Can anyone give some explanation??
asked May 6, 2019 in DS srestha 406 views
1 vote
0 answers
13
Is it TRUE or FALSE? Stack allocation can allocate and deallocate dynamic variables and can manage runtime storage
asked Apr 3, 2019 in Algorithms srestha 228 views
0 votes
0 answers
14
Generate code for the following three-address statements assuming stack allocation where register SP points to the top of the stack x = 1 x=a x = a + 1 x = a+b The two statements x = b * c y = a + x
asked Apr 1, 2019 in Compiler Design aditi19 456 views
1 vote
3 answers
15
Runtime stack doesnot contain (A) Local variables (B) Static Variables (C) Parameter Passed (D) Return Address
asked Mar 1, 2019 in Programming srestha 322 views
0 votes
1 answer
16
infix ,postfix ,prefix expression evalution stack use as operator or operand?
asked Jan 10, 2019 in Compiler Design amit166 149 views
1 vote
1 answer
17
How many enqueue and dequeue operations are required to perform a pop operation if Q1 contains n element initially?
asked Jan 6, 2019 in DS amit166 241 views
1 vote
1 answer
18
5. Assume I have a stack s, a queue q, and a binary search tree t. Initially all of them are empty. Indicate the state of the data structures at line number 7 and at the end. What is the maximum height each of the data structures had during the execution? 1 i $\rightarrow$ 0 2 while i <= ... $\rightarrow$ 0 8 while i <= 9 do 9 t.insert(s.pop()) 10 t.insert(q.get()) 11 i $\rightarrow$ i + 1 12 end
asked Jan 4, 2019 in DS amit166 187 views
1 vote
2 answers
19
true/false ? ) if stack is implemented as a array,all operation push ,pop ,is emptystack(),delete stack() can be performed in constant time. )if stack is implemented as a linked list ,all operation ,is emptystack(),delete stack() can be performed in constant time.
asked Jan 2, 2019 in Programming Gurdeep Saini 403 views
2 votes
0 answers
20
Ginmans Stack are a kind of special data structure in which if there are odd number of elements then the middle most element is popped out and printed on the screen. In case of even number of elements the recently popped out element is again pushed back either on the top or bottom of the stack randomly. Assume ... i, ii ii, iii iii, iv ii, iv
asked Dec 27, 2018 in DS Ruturaj Mohanty 451 views
1 vote
0 answers
21
What is the maximum number of activation records inserted into stack while converting following infix expression to postfix expression is Infix expression: 7+5*3^2/(9-2^2) + 6*4 ??
asked Dec 25, 2018 in Compiler Design anurag sharma 387 views
1 vote
1 answer
22
If two stack is growing two opposite end of array. Then which logic works and how?
asked Dec 24, 2018 in DS srestha 733 views
1 vote
1 answer
23
What’s the right answer ?, please have a look at Q.5(here) they are appending network bits but this question doesn't.
asked Dec 15, 2018 in Computer Networks rahuljai 419 views
1 vote
1 answer
24
Every recursive program uses strictly more stack space compared to its iterative equivalent. This statement is false. Please explain with examples
asked Dec 11, 2018 in Programming Shamim Ahmed 250 views
2 votes
0 answers
25
I THING THERE IS MISTAKE BECAUSE BRACKET ARE CLOSING AFTER ELEMENT E SO ALL OPERATORS HOULD BE POPED AND AND ACCORDING TO ME ANWER SHOLD BE 2… TRY AND CORRECT IF I M WRONG !!!! THANKS IN ADVANCE!!!
asked Dec 7, 2018 in Programming CHïntän ÞäTël 189 views
3 votes
4 answers
26
______ to evaluate an expression without any embedded function calls. Two stacks are required one stack is needed Three stacks are required More than three stacks are required
asked Dec 7, 2018 in DS Arjun 711 views
...