element =stack.push(element); // push one in, O(1)element =stack.pop(); // pop one out, O(1)element =stack.peek(); // see the top element, O(1)stack.isEmpty(); // return true or falsel =stack.length();
q.offer(element); // O(1), out of bound raise Exceptionq.poll(); // O(1), out of bound raise Exceptionl =q.size();