CMPSC 24 Chapter Notes - Chapter 5: Null Pointer, Linked List, Default Constructor

39 views8 pages
30 Jan 2017
School
Course
Professor

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.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents