Changing getLast() from O(n) to O(1) operation