Question
Implement the Stack and Queue interfaces with a unique class that is derived from class LinkedDeque (Code Fragment 5.21).
typedef string Elem; // deque element type
class LinkedDeque { // deque as doubly linked list
public:
LinkedDeque(); // constructor
int size() const; // number of items in the deque
bool empty() const; // is the deque empty?
const Elem& front() const throw(DequeEmpty); // the first element
const Elem& back() const throw(DequeEmpty); // the last element
void insertFront(const Elem& e); // insert new first element
void insertBack(const Elem& e); // insert new last element
void removeFront() throw(DequeEmpty); // remove first element
void removeBack() throw(DequeEmpty); // remove last element
private: // member data
DLinkedList D; // linked list of elements
int n; // number of elements
};
Code Fragment 5.21: The class structure for class LinkedDeque
Explanation / Answer
modified: disabled haxe.rtti.Generic optimization by default, enable with -D 'generic' (replaces 'no_rtti' flag) fixed: DynamicObjectPool: 'object x was returned twice to the pool' assert added: DynamicObjectPool#used() added: Compare#lexiographic() added: Bits#unpackUI16Lo(), unpackUI16Hi() fixed: DLL#lastNodeOf() fixed: TreeNode#levelOrder modified: ObjectPool: allow lazy allocation by using ObjectPool#allocate(true, ...) added: ArrayedDeque#indexOfFront(), indexOfBack() added: LinkedDeque#indexOfFront(), indexOfBack() fixed: HashMap#toArray() added: BitVector#clrRange(), setRange() added: Array2#inRange(), Array3#inRange() added: Array2#getAt(), Array3#getAt() fixed: MemoryAccess#swp() fixed: PriorityQueue#reprioritze(): use float type for priority value fixed: HashSet remove obsolete type parameter added: all except TreeNode+BinaryTreeNode: added reuseIterator flag modified: by default alchemy memory optimization is now disabled, enable with -D alchemy (removed -D 'no_alchemy') added: support for Itr#remove() added: DynamicObjectPool#maxUsageCount() modified: swc: compiled with Haxe 2.08 modified: swc: only show public API (all private fields marked with an underscore are now protected)