CSE 214 Lecture 10: Stacks

57 views2 pages

Document Summary

With tail - o(n) since there is no tail reference which must point to the node before the tail since to remove the node, you must set the link or the next item to null. A stack is a sequence of data elements (of the same type) arranged one after another conceptually. An element can be added to the top of the stack only. (push) An element can be removed from the top of the stack only. (pop) They are last in first out (lifo) or first in last out (filo). Some real life examples include plates, paper cups, etc or anything with a pile. Peek() - see what item is on top without altering the stack. Push() - shift everything over after adding an item. 49

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