4 ms·
But you can do left shifts and right shifts. Your analogy works in comparison to right shifts, but it's backwards if compared to left shifts.
by paholg 3y ago
But you can do left shifts and right shifts. Your analogy works in comparison to right shifts, but it's backwards if compared to left shifts.
- layer8 3y agoFor the question of whether “shift” removes and “unshift” adds or vice versa, it doesn’t matter if it’s left or right shift. Yes, the bookshelf analogy doesn’t tell you at which end the removal or addition occurs. But as I said, I didn’t think this was the question being asked, and if it is being asked, then it can be answered with the index shifting and the comparison to push/pop.