01:198:112 Lecture Notes - Lecture 5: Linked List, Popping

91 views2 pages

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents