3.26. Discussion Questions¶
Convert the following values to binary using the Divide by 2 algorithm. Show the stack of remainders.
Convert the following infix expressions to prefix (use full parentheses):
(A + B) · ( C + D) · (E + F)
A + ((B + C) · (D + E))
A · B · C · D + E + F
Convert the above infix expressions to postfix (use full parentheses).
Convert the above infix expressions to postfix using the direct conversion algorithm. Show the stack as the conversion takes place.
Evaluate the following postfix expressions. Show the stack as each operand and operator is processed.
2 3 · 4 +
1 2 + 3 + 4 + 5 +
1 2 3 4 5 · + · +
The alternative implementation of the queue ADT is to use a list such that the rear of the queue is at the end of the list. What would this mean for Big-O performance?
What is the result of carrying out both steps of the linked list
addmethod in reverse order? What kind of reference results? What types of problems may result?
Explain how the linked list
removemethod works when the item to be removed is in the last node.
Explain how the
removemethod works when the item is in the only node in the linked list.