modified linkedlist and stack from Mark Allen Weiss book