void push(const Type& e){
if (size() == CAP) {
CAP = CAP + 100;
Type * Snew = new Type[CAP];
for (int i = 0; i < CAP - 100; i++){
Snew[i] = S[i];
}
delete[] S;
S = Snew;
}
TOP++;
S[TOP] = e;
}
What is the time complexity of this algorithm and why? I'm looking at it, hoping I'm not wrong, but I think it has linear time (O(n)) complexity due to the presence of a single for loop, and I think every other operation outside of the loop is a constant time operation.