Algorithm For Stack Implementation Using Switch Statement