Algorithm For Stack And Queue Implementation