Ch6 - 1 Nell Dale Chapter 6 Lists Plus Slides by Sylvia...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Nell Dale Chapter 6 Lists Plus Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus C++ Plus Data Structures ADT Sorted List Operations Transformers MakeEmpty InsertItem DeleteItem Observers IsFull LengthIs RetrieveItem Iterators ResetList GetNextItem change state observe state process all 3 class SortedType<char> MakeEmpty ~SortedType DeleteItem . . . InsertItem SortedType RetrieveItem GetNextItem C L X Private data: length 3 listData currentPos 4 What is a Circular Linked List? A circular linked list is a list in which every node has a successor ; the last element is succeeded by the first element. B C L T V Y listData 5 A C F T Z What is a Doubly Linked List? A doubly linked list is a list in which each node is linked to both its successor and its predecessor. listDat a 6 Each node contains two pointers template< class ItemType > struct NodeType { ItemType info; // Data member NodeType<ItemType>* back; // Pointer to predecessor NodeType<ItemType>* next; // Pointer to successor }; . back . info . next 3000 A NULL 7 What are Header and Trailer Nodes? A Header Node is a node at the beginning of a list that contains a key value smaller than any possible key. A Trailer Node is a node at the end of a list that contains a key larger than any possible key. Both header and trailer are placeholding nodes used to simplify list processing. listData INT_MIN 5 8 13 INT_MAX 8 Recall Definition of Stack Logical (or ADT) level: A stack is an ordered group of homogeneous items (elements), in which the removal and addition of stack items can take place only at the top of the stack. A stack is a LIFO last in, first out structure. Stack ADT Operations MakeEmpty-- Sets stack to an empty state. IsEmpty-- Determines whether the stack is currently empty. IsFull-- Determines whether the stack is currently full. Push (ItemType newItem) -- Adds newItem to the top of the stack. Pop (ItemType& item)-- Removes the item at the top of the stack and returns it in item. 9 10 class StackType<int> StackType MakeEmpty Pop Push IsFull IsEmpty Private data: topPtr ~StackType 20 30 11 What happens . . . When a function is called that uses pass by value for a class object like our dynamically linked stack?...
View Full Document

Page1 / 41

Ch6 - 1 Nell Dale Chapter 6 Lists Plus Slides by Sylvia...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online