COMPSCI 61A Lecture Notes - Lecture 18: Init, Linked List

22 views4 pages
zogo39484755 and 6 others unlocked
COMPSCI 61A Full Course Notes
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents

Document Summary

Sequence abstraction is a collection of bejaviors. Element selection: sequence has an element corresponding to any non-negative length :sequence has finite length integer index les than its length, starting at zero. Not just one sequence class or data abstraction (in python or in general) Linked list is either empty or a first value and the rest of the linked list. Linked list is a pair of values. Rest of elements are stored in a linked list, first (zeroth) element is an attribute value. Class attribute represents an empty linked list. Each call to link creates a new instance. Some conventions on how linked lists get drawn. Link. empty is default value for linked list. Assert rest is link. empty or isinstance(rest, link) Can still use isinstance if we create a special kind of linked list. Element selection syntax [] invokes same __getitem__ Methods can be recursive too, implicitly recursive.

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