Stack Algorithm Using Pseudocode