Rewriting ArrayPointerQueue to add O(1) pop operation.