complete methods to implement stack in array