Performance-wise, pushing new elements to the head/top is the slowest, b/c it demands that all the others already inside the container to have their indices right-shifted in order to make room!
Therefore, it’s much preferable to push new elements to the tail/bottom of a container, so there’s no index-shifting.
Given those values you’re using are all int
numbers, best container for them would be the IntList:
Use its append() method in order to push a new int
value to its tail: