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