CP164 Lecture Notes - Lecture 4: Object Copying, Data Structure

61 views2 pages
School
Course
Professor

Document Summary

Breadth first search- grabs the first thing. Array- python list ( make them look like stacks or priority queues. Make python list look like a data structure ( interface look like stack) add pop and push) How do we go from horizontal( list left to right to stack(vertical)) Def of stack: last in first out. Method pop() to pop out end of list. Top of stack is the right-most inhabited element in the stack"s array. Stack empty if there is nothing left in list. (stack object) stack class with two parenthesis. Attributes should be private and treat them as private. Self. _values=[]--> underscore means u can"t touch this outside the class ( except with interface. _values name of python list attribute is python list. Append add to right side a copy of value ( deep copy)--> takes copy of whatever value is adds to top of stack. Data structure cannot be chargeable from outside.

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