CP164 Lecture Notes - Lecture 4: Object Copying, Data Structure
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.