stack implementation with a resizing array