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 22:30
What would be the address of the cell, which is at the intersection of the second row and the third column in a worksheet?
Answers: 1
question
Computers and Technology, 24.06.2019 02:40
Has anyone seen my grandma shes been gone for 4 years already
Answers: 1
question
Computers and Technology, 24.06.2019 06:30
Ineed to know the anwser to all these questions
Answers: 2
question
Computers and Technology, 25.06.2019 02:00
Lisa is making a presentation for her project and she wants to use the logo of her company in her presentation. which element would she use to make her logo stand out in her presentation? a. gradation b. contrast c. alignment d. balance
Answers: 1
You know the right answer?
Examine the following declarations and definitions for the array-based implementations for the stack...
Questions
question
Physics, 20.09.2020 19:01
question
Mathematics, 20.09.2020 19:01