Absolute C++ (4th Edition) part 75

Absolute C++ (4th Edition) part 75. KEY BENEFIT: C++ programming concepts and techniques are presented in a straightforward style using understandable language and code. KEY TOPICS: C++ Basics; Flow of Control; Function Basics; Parameters and Overloading; Arrays; Structures and Classes; Constructors; Operator Overloading, Friends, and References; Strings; Pointers and Dynamic Arrays; Separate Compilation and Namespaces; Streams and File I/O; Recursion; Inheritance; Polymorphism and Virtual Functions; Templates; Linked Data Structures; Exception Handling; Standard Template Library; Patterns and UML. MARKET: Useful for both beginning and intermediate C++ programmers. . | Answers to Self-Test Exercises 747 Chapter Summary A node is a struct or class object that has one or more member variables that are pointer variables. These nodes can be connected by their member pointer variables to produce data structures that can grow and shrink in size while your program is running. A linked list is a list of nodes in which each node contains a pointer to the next node in the list. The end of a linked list or other linked data structure is indicated by setting the pointer member variable equal to NULL. A stack is a first-in last-out data structure. A queue is a first-in first-out data structure. Both can be implemented using a linked list. An iterator is a construct typically an object of some iterator class that allows you to cycle through data items stored in a data structure. A tree is a data structure whose nodes have two or more member variables for pointers to other nodes. If a tree satisfies the Binary Search Tree Storage Rule then a function can be designed to rapidly find data in the tree. Answers to Self-Test Exercises Sally 18 18 Note that head .name and head- name mean the same thing. Similarly head .number and head- number mean the same thing. 2. The best answer is head- next NULL However the following is also correct head .next NULL 3. head- item Wilbur s brother Orville 4. class NodeType public NodeType NodeType char theData NodeType theLink data theData link theLink NodeType getLink const return link char getData const return data void setData char theData data theData 748 Linked Data Structures void setLink NodeType pointer link pointer private char data NodeType link typedef NodeType PointerType 5. The value NULL is used to indicate an empty list. 6. pl p1- next 7. Pointer discard discard p2- next discard points to the node to be deleted. p2- next discard- next This is sufficient to delete the node from the linked list. However if you are not using this node for something else you should destroy the node with a call .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
12    20    1    23-11-2024
24    17    1    23-11-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.