仅供自勉和记录所用, copyright is held by Berkeley CS61B
刷题记录在Dropbox Paper上
2019 May 20
2019 June 18 || Mon 01/28
The golden rule of equals:
- b=a copies the bits from a to b
- Passing parameters copies the bits (pass by values)
Types:
- primitive types (9)
- reference types (others)
(reference type declaration; reference type instantiation (return the address); )
IntList and Linked Data Structures
recursion / loop
2019 June 19 || Wed 01/30
Why nested class?
Nested Classes are useful when a class doesn’t stand on its own and is obviously subordinate to another class.
Why static Nested Classes?
If the nested class never uses any instance variables or methods of the outer class, declare it static.
Caching:
Caching: putting aside data to speed up retrieval.
Sentinel and Sentinel Node (“keep the same”)
Invariants:
An invariant is a condition that is guaranteed to be true during code execution
2019 June 20 || Fri 02/01
- DLList
- Incorporating the Sentinel Recall that we added a sentinel node to our SLList. For DLList, we can either have two sentinels (one for the front, and one for the back), or we can use a circular sentinel.
- A DLList using a circular sentinel has one sentinel.
- The sentinel points to the first element of the list with next and the last element of the list with prev.
- In addition, the last element of the list’s next points to the sentinel and the first element of the list’s prev points to the sentinel.
- For an empty list, the sentinel points to itself in both directions.
-
<