01:198:112 Lecture Notes - Lecture 5: Linked List, Popping
Document Summary
Stack is a concept not an actual data structure. Pops off whatever is the top of the stack. Pushes data into the stack, such in a way that the most recently pushed. Making a counter to keep track of the top allows one to keep track of what is being popped and being popped. If there is more items to push than there is to pop than there you cannot push anymore items. Solution: create a new array double the size of the original array and copy everything over. Pushing new data is a constant time operation as long as you add to the front. Popping takes constant time as long as you are popping from the front. Create a try block with a catch exception at the end of the try block. Within the catch exception block, handle the exception. Put in the code that is the exception. E. g. imagine how grocery store lines work.