First time here? Checkout the FAQ!
0 votes

Loading Question

asked in Programming by Veteran (10.2k points)   | 132 views
here what does w.r.t to Top means. Pop operation removes top element.  so value of I should be 0 or 1????
Is it option B ?
in key D os given but i think D is not answer.

1 Answer

+3 votes
Best answer
If we need to get $I^{th}$ element from Top, we require at least $I$ element in stack. So, $Top \geq I$ and underflow condition is $Top < I \\ \implies Top+1 \leq I \\ \implies Top -I+1 \leq 0$
answered by Veteran (281k points)  
selected by
supppose we have n=5 element,,and bottom of stack is 0 so top will be 4,,,now we want to delete 5th element wrt top(that is 0th element) now


so 0<=0 but no underflow....after this it can be underflow
@Arjun sir, if stack contains a,b,c,d,e,f and base-0 which contains a, and top will be be pointing to f, then what will be the 1 st elemtent wrt to top.??? e or f???

Top Users Mar 2017
  1. rude

    5118 Points

  2. sh!va

    3054 Points

  3. Rahul Jain25

    2920 Points

  4. Kapil

    2730 Points

  5. Debashish Deka

    2602 Points

  6. 2018

    1574 Points

  7. Vignesh Sekar

    1422 Points

  8. Akriti sood

    1382 Points

  9. Bikram

    1350 Points

  10. Sanjay Sharma

    1128 Points

Monthly Topper: Rs. 500 gift card

21,531 questions
26,861 answers
23,206 users