top and (pop with StackEmpty) does not change the size of the stack. so, size of stack = number of push operations - number of pop operations size of stack = 25 - 10 = 15 Answer: 15
Question 5 10 pts Suppose an initially empty stack has performed a total of 25 push...
A. Starting with an initially empty stack, after 6 push operations, 3 pop operations, and 2 push operations, the number of elements in the stack would be: B. Starting with an initially empty queue, after 5 enqueue operations, 4 dequeue operations, and 6 enqueue operations, the number of elements in the queue would be:
Suppose that we start with an empty stack and execute the operations: push(5) push(12) popo) push(3) push(7) popo) What values are returned by the two pop() operations above, in order? First pop(): Second pop(): Suppose that we start with an empty stack and execute the operations: enqueue(5) enqueue(12) dequeue enqueue(3) enqueue(7) dequeuel) What values are returned by the two pop() operations above, in order? First dequeue(): Second dequeue():
Question 5 16 pts Let set A = {a,b,c} Which of the following are proper subsets of A? {a} a, b {a, b} {a,b,c} {d} Question 6 10 pts Let A = {ne Z | n = 6a + 4 for some integer a} Let B = {me Z m = 18b - 2 for some integer b} Prove or disprove that ASB Hint: follow the method used in Example 6.1.2 on page 338 of the text. HTML Editora B...
// thanks for helping // C++ homework // The homework is to complete below in the stack.h : // 1. the copy constructor // 2. the assignment operator // 3. the destructor // 4. Write a test program (mytest.cpp) to test copy and assignment // 5. Verify destructor by running the test program in Valgrind // This is the main.cpp #include <iostream> #include "stack.h" using namespace std; int main() { Stack<int> intStack; cout << "\nPush integers on stack and dump...
Question 12 10 pts M&M bank has $30 million in checking deposits and another $70 million in savings deposits. M&M has lent out $80 million in long-term, fixed interest loans and has invested $25 million in short-term treasury bonds while maintaining reserves of $15 million. a) What items make up the bank's assets? What is total amount of assets? b) What items make up the banks' liabilities? What is the total amount of liabilities? c) What is the amount of...
what is the actual IUPAC name(s)?
Question 15 14 pts Compound(s) X can be prepared by the methods outlined in Figure 1 below: Figure 1: Organic Synthesis of Compound(s) X 1.) NAOH 2) diety 2 bromomalonate Na . TOH Compound(s) 3.) NOEL 4) benzyl bromide 5.) H70 (excess) Step 5 5.) H20" (excess) --- Step 1 1) NaOH diethyl 2-bromomalonate of the art Step 4) benzyl bromide benzyl bromide Step 2 2.) diethyl-2-bromomalonate Na TO Na o 3.) : 0...
**TStack.py below**
# CMPT 145: Linear ADTs
# Defines the Stack ADT
#
# A stack (also called a pushdown or LIFO stack) is a compound
# data structure in which the data values are ordered according
# to the LIFO (last-in first-out) protocol.
#
# Implementation:
# This implementation was designed to point out when ADT operations are
# used incorrectly.
def create():
"""
Purpose
creates an empty stack
Return
an empty stack
"""
return '__Stack__',list()
def is_empty(stack):
"""...