Illustration

Time Complexity of ArrayList Insertion

Then calculate the average time complexity of inserting n new items into an empty brand new ArrayList.


Problem Statement

Explain how an ArrayList works in Java. Then calculate the average time complexity of inserting n new items into an empty brand new ArrayList.


Evaluation


  • The explanation of how an ArrayList allocates memory (25%)

  • The expanded mathematical calculation of the cost of insertion over time (25%)

  • Mathematical and order notation simplification (25%)

  • Correctness of the final O notation and the grand conclusion (25%)


References

Vlad is a software architect at Lionside, a Bay Area gaming startup. He asked me this during an interview.

Amin A.

Written by

Amin Ariana

A software entrepreneur from San Francisco