use linked list instead of arrayList for stack