Professional Documents
Culture Documents
data structure that allows _______________ [2] and _____________________ [3] elements in a
particular order. Every time an element is added, it goes on the _____________ [4] of the stack.
_______________() [7]
__________________ [5]
____________() [6]
8.________________________________________________________________________________________
__________________________________________________________________________________________
9.________________________________________________________________________________________
__________________________________________________________________________________________
10._______________________________________________________________________________________
__________________________________________________________________________________________
11._______________________________________________________________________________________
__________________________________________________________________________________________
12
13
14
if(_____________________)
return;
_____________;
stack[___________]=data;
int tempVar;
if(_______________________)
return(-1);
tempVar = stack[top];
______________;
return tempVar;
□□□□□□□
1. Stack implemented using linked list works for __________________ size of data.
2. In linked list implementation of a stack, every new element is inserted as ___________
element.
3. The next field of the first element in linked list implementation of a stack must be
always __________
4. PUSH 25, 32, 50 and 99 and fill up the following
Top
tmp->link = _____________;
top = _________;
return ___________;
}
9. node *stack_list::pop(node *top)
{
node *tmp;
if (top == NULL)
cout<<"_______________ "<<endl;
else
{
tmp = top;
cout<<"Element Popped: "<<tmp->info<<endl;
top =_______________;
free(tmp);
}
Return______________;
}
10. void stack_list::traverse(node *top)
{
node *ptr;
ptr = top;
if (________________)
cout<<"Stack is empty"<<endl;
else
{
cout<<"Stack elements :"<<endl;
while (_________________)
{
cout<<ptr->info<<endl;
ptr =________________;
}
}
}
5. The postfix expression of the given Infix expression: (A+B)*C is AB*C+. State True or False _______
10. What is the Prefix expression of the given Infix expression: A+(B-C)*D$(E*F)
11. Consider the following infix expression. ((A+B)*C-(D-E))^(F+G) Note: ^ denotes the power.
13. Evaluate the following postfix expression. All numbers are single digits.
246+*5/32↑42-*+
2. For closing parenthesis, check the _____________of the stack, if it corresponding opening
parenthesis, _____________it from the top of the stack.
4. After processing entire string, check if stack is ___________________. If the stack is empty,
return ____________. else ______________.
6. for the given input trace the stack contents and operations ( ( ) ( ( ) ) )
Input Input Operation Stack Symbol
(()(( ))) ( (
()(( ))) (
)(( ))) ) (
(( ))) ( PUSH
( ))) (
))) ) (
)) ) POP (
) )
1. Whenever a function calls another function or itself as callee, the caller function
transfers execution control to ______________. This is called _____________.
2. F(n)
F(n-1) ○
○
F(n-2)
a?
○
○ b?
○
c? d?
1
2
3
6. Tower of hanoi puzzle with n disks can be solved in minimum ____________ steps.
7. If we have 2 disks −
• And finally, we move the (Smaller / larger) from aux to destination peg.
IF disk == 0, THEN
ELSE
END IF
END Procedure