in DS reopened by
3,925 views
2 votes
2 votes
A stack of size (1 to N) and the initial position of top pointer is 0.
get(i,S) is aroutine to get ith element from stack 'S' with respect to top.
then,what is the underflow condition on stack to perform get() operation?
$A) top-i<N$
$B) top-i+1<=N$
$C) top-i<=0$
$D) top-i+1<=0$
in DS reopened by
3.9k views

1 Answer

4 votes
4 votes

Option D

by

4 Comments

if (top = = N )

printf("overflow");

 already given brother 

0
0
I want to answer in terms of $i$

I think if(top=N+1)??

Because (top==N) point the last element.
0
0
PEEP FUNCTION -to fnd ith element  from top of stack without deleting it

to check stack underflow(top−i+1<=0)
0
0