here it is
Explain why we need both an iterator and a const_iterator
2. 22.. 2.
Indicate whether you should use an iterator or a const_iterator as a parameter in new functions for the list class that would perform each of these operations. Also, provide a heading for each function.
a. Insert a new element after the current iterator position.
b. Replace the data stored in the currently selected item.
c. Retrieve the data stored in the currently selected item.
d. Insert a new element before the currently selected item.
3. 33.
Programming: PPrrooggrraammmmiinngg:: Programming: Write a function that reads a line and reverses the words in the line (not the characters) using a stack. For example, given the following input:
The quick brown fox jumps over the lazy dog.
You should get the following output:
dog. lazy the over jumps fox brown quick The
4. 44.. 4.
Trace the evaluation of the following expression using class Postfix_Evaluator. Show the operand stack each time it is modified (Use Postfix_Evaluator
10 2 * 5 / 6 2 5 * + –
5. 55.. 5. (Weight: 10%)
Trace the evaluation of the following expression using class Postfix_Evaluator. Show the operand stack each time it is modified (Use Postfix_Evaluator). 10 * 5 / 6 2 5 * + –
6. 66.. 6. (Weight: 10%)
Trace the conversion of the following expressions to postfix using class Infix_To_Postfix or Infix_To_Postfix_Parens. Show the operator stack each time it is modified. y – 7 * 35 + 4 / 6 – 10 ( x + 15 ) * ( 3 * ( 4 – (5 + 7 / 2 ) ) )
7. (Weight: 5%)
How would you modify class Infix_To_Postfix to handle the exponentiation operator, indicated by the symbol ^. The first operand is raised to the power indicated by the second operand. Assume that a sequence of ^ operators will not occur and that precedence('^') is greater than precedence('*').
8. 88.. 8. (Weight:10%)
Write an algorithm to display all the elements in a queue using just the queue operations. How would your algorithm change the queue?
9. 99.. 9. (Weight:15%) Programming: PPrrooggrraammmmiinngg:: Programming: Code the push_front and pop_back functions for the class deque
10. 1100.. 10.
(Weight:10%) Programming: PPrrooggrraammmmiinngg:: Programming: Write a new queue function called move_to_rear that moves the element currently at the front of the queue to the rear of the queue. The element that was second in line will be the new front element. Do this using functions push, front, and pop.
GET ANSWERS / LIVE CHAT