an implementation of a lower time complexity array