I need these questions to be answered as it is 3. Which of the following is not
ID: 3677407 • Letter: I
Question
I need these questions to be answered as it is
3. Which of the following is not true with regard to bags?
26.Using the Postfix evaluation algorithm, evaluate the following postfix expression.
Assume that w = 3 , x = 4, y = 2, z = 7.
27.In a linked-chain implementation of a Stack ADT, when a node is popped from the stack?
28.In an array-based chain implementation of a Stack ADT, the entry peek returns may be found at?
29. (4 pts) X is a queue of Integers. What are the contents of queue X through the following operations? (Be sure to clearly indicate the front of the queue.)
_______________________________________________________
30. (4 pts) Given a queue X of integers containing 7, 2, 5, 9, 3, 3 (from front to rear), what would be the result of each of the following statements if they are executed in that order? (Assume that k is an int.)
31. (2 pts) When enqueueing an element on circular array implementation of a queue, the Java statement to update (wrap around) the front variable is:
Explanation / Answer
26.Using the Postfix evaluation algorithm, evaluate the following postfix expression.
Ans :
converting from ((3 + 5 1)=8) 14 to 3 5 1 +8 = 14 (I have done that). now evaluating the latter expression. The instructions I have:
Given a postx expression v 1:::v n, where v i is either an operand or an operator, the following algorithm evaluates the expression. A helper string, temp2, is used during the calculation.
while i<= n
if v_i is an operand: Push v_i to tmp2.
if v_i is an operator: Apply v_i to the top two elements of tmp2. Replace these by the result in tmp2.
code :
i get
temp2.length() + i - 1 is a valid index only for i <= 0 && i > - (temp2.length() - 1) –
28 Ans :
Array Implementation
Below is the definition of the Stack class, using an array to store the items in the stack; note that we include a static final variable INITSIZE, to be used by the Stack constructor as the initial size of the array (the same thing was done for the List class).
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.