bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_2 / algorithms / algo_028.md

algo_028.md (308B)


      1 # algo_028
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to push a element to stack.
      6 
      7 ## Algorithm
      8 ```
      9 procedure push(stack[], top, n, val)
     10 begin
     11     if(top = n - 1)
     12         write("Stack full, insertion not possible.");
     13     else
     14         top ← top + 1;
     15         stack[top] ← val;
     16     endif
     17 end procedure
     18 ```