algo_031.md (399B)
1 # algo_031 2 3 ### Problem Statement 4 5 > Write an algorithm to pop to stack (Linked representation of stack) 6 7 ## Algorithm 8 ``` 9 Procedure pop(stack, val) 10 begin 11 if (stack = NULL) then 12 write("Stack Underflow"); 13 return(stack); 14 else 15 ptr ← stack; 16 val ← INFO(ptr); 17 stack ← next(ptr); 18 delete(ptr); 19 return(stack); 20 endif 21 end procedure 22 ```