CPS 6, Ramm - Summer Semester I - 6/23/99 #23
- Announce
- Coint Toss for Random Quiz #11
-
Chap 12. Information Hiding & Dynamic Data
- Motivation for Pointers
- More precise control of memory allocation
- (Vectors were doubled on resizing)
- Provide indirect references for sharing
- Linked Data Structures need pointers
- Pointers as Indirect References
- Pointer holds a memory address
- Pointer refers to something indirectly
- Indexes, Directories, Mail Addresses
- Pointers Definition
- int * p;
- Dice * diePtr;
- string * strP;
- Pointers as References
- address: below the surface
- * dereference operator
- & address-of operator
- Examples
- Pointer uses (conceptual)
- Tag Sorts
- Sort list by more than one key
- Pointers as Parameters
- swap using reference parameters
- swap using pointers (C style)
- The
new Operator
- The Selection Operator
->
- Simple Examples
- Implementing a Tag Sort
- Use a vector of pointers
- Modify Selection Sort
- Linked Lists
- Pointer Diagrams
- Conceptual
- The Null Pointer
- The Four Ways to Assign a Value to a Pointer
- Assign value generated by
new operator
- Assign value generated by the address of (
& operator
- Assign value from another pointer
- Assign the special value 0 or
NULL
- The Stack
- Empty
- Overflow?
- (Vector Implementation)
- Delete
- Implementing a Stack
- Compare to Vector (sequential) Implementations
- Sorted
- Cost of Insertion
- Cost of Search
- Cost of Deletion
- Unsorted
- Cost of Insertion
- Cost of Search
- Cost of Deletion
- Other Linear Lists
- Constructors Revisited
- For structs
- Initialization
stack2.cc
- The Destructor Member Function
- Trees
- Conceptual
- Applications
- E.g., Binary Sort
- Binary Sort Trees
- Updates
- The const property of functions
- C Strings
- Accessing Characters
- Finding Length
- Copying Strings and other Aggregates