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

37 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+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents