CMPSC 24 Chapter Notes - Chapter 5: Null Pointer, Linked List, Default Constructor
Document Summary
Linked lists are used to implement a list of items arranged in some kind of order. 5. 1 a fundamental node class for linked lists. Linked list = sequence of items arranged one after another. Each item is connected to the next by a link. Node = a component resulting from placing each item together with the link to the next item. Links between nodes are implemented using pointers to nodes. The node class depends on an underlying data type / type of data in each node. Typedef statement class node { public: typedef double value_type; private: value_type data_field; node *link_field; Linked list is accessed through 1+ pointers to nodes. Head pointer = a pointer to the first node. Tail pointer = pointer to the last node. Each pointer to a node must be declared as a pointer variable: node *head_ptr; node* tail_ptr; Null pointer = indicated by null, a special c++ constant.