Question: PLEASE NOTE: You may not use any Standard Template Library (STL) classes when implementing this programming project. Working with Lists 1. Create an overload of
PLEASE NOTE: You may not use any Standard Template Library (STL) classes when implementing this programming project. Working with Lists
1. Create an overload of the insert method that appends the items of one list to another.
void List::insert( const List & list );
2. Create an overloaded method on the List class that sorts the items in the list. The first overload, sort(), sorts the items in ascending order; the second, sorts them in the order specified by a comparator function, e.g., in descending order.
void List::sort();
void List::sort(bool (*comparator)( T &, T & ));
Working with Queues
1. Create a method on the Queue class that calculates the number of times a given value occurs in the queue.
int Queue::count( const T & data ) const;
Example: count() function Result Queue count (5) 3 front->(1) (1) (5) (3) (5) (5) (2)<-back count (10) 0 front->(1) (1) (5) (3) (5) (5) (5) (2)<-back
2. Create a method on the Queue class that determines whether the queue is in descending order.
bool Queue::isDecreasing( ) const;
Example: isDecreasing() function Result Queue count (5) true front->(10) (9) (8) (7) (1)<-back count (10) false front->(1) (1) (5) (3) (5) (5) (5) (2)<-back 2 Working with Stacks
1. Create a method on the Stack class that determines whether a given value occurs consecutively in the stack.
bool Stack::isConsecutive( const T & data ) const;
Example: isConsecutive() function Result Stack isConsecutive (5) true top->(1) (1) (5) (3) (5) (5) (2) isConsecutive (3) false top->(1) (1) (5) (3) (5) (5) (5) (2)
2. Create a method on the Stack class that reverses the values on the stack.
void Stack::reverse();
Example: reverse() function Stack original Result:
Stack reversed reverse () top->(1) (1) (5) (3) (5) (5) (2) top->(2) (5) (5) (3) (5) (1) (1) reverse () top->(1) (1) (5) (3) (5) (5) (5) (2) top->(2) (5) (5) (5) (3) (5) (1) (1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
