Java Reference
In-Depth Information
696
697
You should enhance this algorithm to deal with parentheses. Also, make
sure that subtractions and divisions are carried out in the correct order.
For example, 12 Ċ 5 Ċ 3 should yield 4.
ANSWERS TO SELF-CHECK QUESTIONS
1. Yes, for two reasons. You need to store the node references, and each node
is a separate object. (There is a fixed overhead to store each object in the
virtual machine.)
2. An integer index can be used to access any array location.
3. When the list is empty, first is null . A new Node is allocated. It's
data field is set to the newly inserted object. It's next field is set to
Search WWH ::




Custom Search