CSCA48H3 Lecture Notes - Lecture 5: Item Number, Init, Empty String

34 views4 pages

Document Summary

Restaurants usually keep dishes in a stack. When a dish is cleaned, we place it on the top of the stack. When a dish is needed, we take one from the top of the stack. So plates are removed in the reverse order of when they were put into the stack. The data which the stack contains is a sequence of arbitrary objects/elements. The objects are extracted and removed in reverse order of which they were inserted. The position where items go in and come out is called the top Add an object o to the top of the stack. Remove and return the object at the top of the stack. This requires that the queue is not empty. A standard queue may also have a top() operation, which returns the item at the head without removing it is_empty(): Returns whether or not the queue is empty (boolean value)

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents