CMPT 115 Lecture Notes - Lecture 7: Linked Data, Pseudocode, Null Pointer
Document Summary
Pre-lists: getting the hang of linked data structures. Notes written by michael horsch, mark eramian, ian mcquillan, lingling jin, and dmytro dyachuk. After this topic, students are expected to: explain the way records can link to records of the same type, use linked records in simple expressions, draw diagrams of linked records, use linked records in simple algorithms. Element data; reftonode next; // points to another node. Focus on the linking, not the data here! Draw a diagram for the following pseudo-code sequence: Node *x allocate new node x data 5 x next null. Node *y allocate new node y data 1 y next x. Node *z allocate new node z data 8 z next y print (z data) print (z next data) print (z next next data) Remember: x data means (*x). data, x next means (*x). next data next. Node *x allocate new node x data this x next null.