Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need these answers ASAP within 30mins if possible. Question 13 pts (TCO 3) Which

ID: 3885650 • Letter: N

Question

Need these answers ASAP within 30mins if possible.

Question 13 pts

(TCO 3) Which is the last element in a stack that will be removed?

Flag this Question

Question 23 pts

(TCO 3) What is the stack operation implemented in the following function? The variable n represents the stack top.  

void operation()
{
     n--;
}

Flag this Question

Question 33 pts

(TCO 3) Consider the following program fragment.

Stack s;
s.push(1);
s.push(2);
s.push(3);
s.push(4);
cout << s.peek() << endl;

What is the value displayed by the cout statement?

Flag this Question

Question 43 pts

(TCO 3) The _____ is a data structure that satisfies the FIFO (first in, first out) principle.

Flag this Question

Question 53 pts

(TCO 3) Which is the queue operation implemented in the following function? The variable count represents the number of elements in the queue.

operation()
{
    front = 0;
     back = size-1;
     count = 0;
}

Flag this Question

Question 63 pts

(TCO 3) Consider the following program.

Queue q;
q.enqueue(1);
q.enqueue(2);
q.enqueue(3);
q.dequeue();
cout << q.getFront() << endl;

What is the value displayed by the cout statement?

Flag this Question

Question 73 pts

(TCO 3) If the numbers 49, 16, 36, 25 are inserted, in that order, in a queue, which will be the second element to be removed?

Flag this Question

Question 83 pts

(TCO 3) In the _____ ADT, insertions and deletions occur at the top of the list of elements

Flag this Question

Question 93 pts

(TCO 3) An effective way to implement a priority queue is to use a _____.

Flag this Question

Question 103 pts

(TCO 8) In C++ STL, _____ is a generic class representing stacks.

The element that was inserted first

Explanation / Answer

13.option(1) element that was inserted first

explanation: stack follows last in first out so element which insert first will be removed last

23. option(3)pop

explanation: when pop the elements pointer will decrement by 1

33.option(4) 4

Eplanation:Reads and returns the next character without extracting it so here 4 is the last element inserted on top of stack so 4 will return by peek()

43.option(4)queue

Explanation: queue is a data structure that follows first in first out(FIFO)

53.option(3)queue initialization

Explanation: in this code

operation()
{
    front = 0;
     back = size-1;
     count = 0;
}// there is no icrement or decrement in sizes as well as count henece we can say it is just an initialization

63.option(2) 2

Explanation:elemets are inserted at rear in the order of 1,2,3

so from rear to front elements are in the order of 3,2,1,

one dequeue operation performed at front so 1 ll be dequeued then 2 is at top of front so q.getFront() will return 2

73.option(2)16

Explanation: elemets are inseted in the order of 49,16,36,25

so from rear to front order will be: 25,36,16,49

we perform dequeue at front so at front 49 is the first element and 2nd element is 16

83.option(1)stack

Explanation: a structure where insertion and deletion of items takes place at one end called top of the stack

93.option(2)heap

Explanation:To make all of the operations very efficient in priority queue, we'll use a new data structure called a heap.

103.option(1)stack

Explanation: you could make a templated stack class that can handle a stack in generic class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote