time complexity of stack using array