Measuring Efficiency Efficiency is the measure of how long our program would take to run. Ex: The recursive computation of the fibonacci sequence def fib(n): if n == 0: return 0 ...
CS61A: Efficiency
CS61A: Composition
Linked Lists A type of recursive data structure that stores a sequence of values. A linked list is either empty a first value and the rest of the linked list Thus, a...
CS61A: Representation
String Representations An object value should behave like the kind of data it is meant to represent Part of this ability is to provide a string representation of a program T...
CS61A: Inheritance
Inheritance A method for relating classes together. A common use case is two similar classes that differ in their degree of specialization The specialized class has same attributes as a gene...
CS61A: Lecture 21
Lecture Composition A linked list is a recursive data structure that represents a sequence. List Efficiency - Fast Appending, assigning, and list comprehensions are fast The...
CS61A: Attributes
Attributes Method Calls Method calls differ from function calls because they are invoked with dot notation. <expression>.<name> The <expression> can be any va...
CS61A: Objects
Object-Oriented Programming OOP provides a method for organizing large programs large programs can be organized into small, modular components that can be developed at ones. Ext...
CS61A: Lecture 17
Objects Review - Mutability What would be the final values of the names defined within this code segment? def func1(lst1): lst1 = lst1[0:-1] return lambda lst: lst + lst1 def func2(ls...
CS61A: Lecture 16
Generators An iterable is any sequence we can iterate over (we may clal iter() on the iterator and get an iterator) An iterator allows us to iterate over any iterable sequence (we can call nex...
CS61A: Generators
Generators A special form of an iterator that is returned from a generator function. The generator object iterates over all yielded values of a function. In the generator funtion, we ...