CMPS 223 Data Structures and Algorithms Assignment 3: Doubly-Linked List & Iterator I. Purposes: Understand doubly-linked list and know to design and implement simple structure so that use can traverse list items in forward and backward direction. II. What you are going to do: Notice that no display(), and friend << operator defined. There are 4 class templates to implement: (1) Iterator -- a abstract template class for easy traversing list items. (2) DLList -- doubly-linked list template clas for list which has two inner classes. (3) Node -- template class for node in list with double pointers and a data field. (4) DLListIterator -- an implementation of Iterator class. (*) You have to add iterator() in DLList class to make use of Iterator easy. (**) No display or << operator() should be dfiend. (***) The menu options are different from assignment 2. The 4 template classes are specified below, and feel free to add necessary functions. 1. Define an abstract Iterator class template with following functions: template class Iterator { bool hasNext() const; T next() ; // return the next list item } 2. Define DLList class template with two inner class template inside list class: template class DLList { protected: class Node { public: T data; Node *next, *previous; Node( const T & ); ~Node(); }; class DLListIterator : public Iterator { protected: Node * cur; bool forward; public: DLListIterator( bool, Node * ); bool hasNext() const; T next() ; }; int count; Node *head, * tail; public: DLList( ); ~DLList(); DLList( const DLList& ); Iterator * iterator( bool fwd ); bool empty() const; // Return this for cascade calls. (obj, pos) DLList& insert( const T & , int ); T erase( int ) ; }; III. Use and make a few changes to your main program and menu for assignment one to test the singly linked list implementation. Menu for assigment 2 should be like the following: +=========================================+ | HW3 : Doubly Linked List/Iterator | +=========================================+ | C: Create one integer and one character | | list, and insert 10 random values in | | each list. The value ranges of lists | | 0 ... 99 and 'A' .. 'Z'. | +-----------------------------------------+ | F: Show list items in forward direction | | using iterator. | +-----------------------------------------+ | B: Show list items in backward direction| | using iterator. | +-----------------------------------------+ | A: Ask for a int and a char value, | | insert the values at random poistions| | of the lists. | +-----------------------------------------+ | D: Generate a random position, and | | remove values at the positions of the| | int and char lists. | +-----------------------------------------+ | H: Show this menu. | +-----------------------------------------+ | Q: Exit program. | +-----------------------------------------+