Lab 04
Here is a pdf version of the ppt I covered during the lab. And the codes that I (skimmed through) / (demonstrated live).
content.pdf (The pdf version of the ppt shown)
postfix_eval.cpp (Using STL Stack to evaluate a postfix expression)
Challenge Questions -
Q) Try to modify/implement a new postfix evaluator which can take in numbers consisting of more than 1 digit.
Solution
TBAQ) Read up/Try to find the differences between STL Deque (Double Ended Queue) and STL List (Doubly linked list)
Solution
Apart from that the broad differences I am able to find are -- DEQUE is like a superset of VECTOR. It is VECTOR ABILITIES + PUSH_FRONT + POP_FRONT.
- The only feature lacking in DEQUE that is there in vector is mehtod capacity and reserve.
- List differs from vector, in mainly back-end implementation and some pros and cons as follows -
- Vector/Deque has O(constant time) access to a random element, whereas List has O(N).
- List can do insertion in O(1) in between, given it has an iterator to the immediate previous/next element where we want to insert. For a vector/deque the insertion in between is always O(N) (irrespective of the fact that we have an iterator or not)
Visit here for more info