subject

Examine the following declarations and definitions for the array-based implementations for the stack and queue adts. assume that exception class pushonfullstack and class poponemptystack have been defined and are available. read the following code segment and fill in blank #6.

class stacktype
{

public:

stacktype();

void push(stackitemtype item);

void pop();

private:

int top;

itemtype items[max_stack];

};

void stacktype: : stacktype()

{

top = -1;

}

void stacktype: : push(itemtype item)

{

// 1

; // 2

; // 3

; // 4

}

class quetype

{

public:

// prototypes of quetype operations

// go here

private:

int front;

int rear;

itemtype items[max_queue];

}

void quetype: : quetype()

{

front = max_queue - 1;

rear = max_queue - 1;

}

boolean quetype: : isempty()

{

return (rear == front);

}

void quetype: : enqueue(itemtype item)

{

; // 5

; // 6

}

[1] rear = (rear +1) % max_queue
[2] items[rear] = item
[3] rear = (rear % max_queue) + 1
[4] items[front] = item

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
question
Computers and Technology, 23.06.2019 20:00
How much current flows through the alternator brushes? a. 2–5 a b. 25–35 a, depending on the vehicle c. 5–10 a d. 10–15 a
Answers: 2
question
Computers and Technology, 24.06.2019 00:50
3. what is the output of the following statements? temporary object1; temporary object2("rectangle", 8.5, 5); temporary object3("circle", 6, 0); temporary object4("cylinder", 6, 3.5); cout < < fixed < < showpoint < < setprecision(2); object1.print(); object2.print(); object3.print(); object4.print(); object1.set("sphere", 4.5, 0); object1.print();
Answers: 1
question
Computers and Technology, 24.06.2019 08:00
How can smart devices benefit businesses, organizations, and social communities in the global marketplace?
Answers: 1
You know the right answer?
Examine the following declarations and definitions for the array-based implementations for the stack...
Questions
question
Mathematics, 30.03.2021 03:00
question
Mathematics, 30.03.2021 03:00
question
Mathematics, 30.03.2021 03:00
question
Business, 30.03.2021 03:00
question
Mathematics, 30.03.2021 03:00
question
Mathematics, 30.03.2021 03:00
question
Mathematics, 30.03.2021 03:00
question
Mathematics, 30.03.2021 03:00
question
English, 30.03.2021 03:00
Questions on the website: 13722362