Modified insertAtBack to O(1) instead of O(n)