Dynamic Stack Using Arraylist

Why cannot we use ArrayList for the dynamic stack,
why did you prefer array instead of ArrayList

@twentyonedot
yes you can implement stack using ArrayList as well. but need to take care that all pop() and push() operation need to be O(1)

I understand I can use arraylist, but in video array is preferred for dynamic stack implementation, is there any specific reason for that?

@twentyonedo
yeah because we are absolutely certain that all operation are o(1)
that the main point.

Ok, got it, last one-
Can’t we implement other methods in O(1) using arraylist

I mean if we use arraylist from the beginning, there is no need another class for dynamic stack and inheritance right?

@twentyonedot
yes but most of the time you will not be creating dynamic stack instead you will be using inbulid stack.

got it, thanks for the reply

@twentyonedot
mark your doubt as resolved in my doubt section and rate me as well.