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, 22.06.2019 06:00
The width of a piece of rectangular land is 5m shorter rhan 1/3 of its length .find the width of the land if the length is 60m,150m.
Answers: 1
question
Computers and Technology, 22.06.2019 10:00
Jackson is teaching the decimal number system. he wants his students to know how to expand numbers by powers of 10. which is the correct order in which digits are assigned values in the decimal number system?
Answers: 1
question
Computers and Technology, 22.06.2019 21:40
Develop a function to create a document in the mongodb database “city” in the collection “inspections.” be sure it can handle error conditions gracefully. a. input -> argument to function will be set of key/value pairs in the data type acceptable to the mongodb driver insert api call b. return -> true if successful insert else false (require a screenshot)
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
Jason needs to learn a new web tool. he went through his books to understand more about it. now he wants hands-on experience with using that tool. what would him? jason can use websites where workspace is provided to test the results of your code.
Answers: 2
You know the right answer?
Examine the following declarations and definitions for the array-based implementations for the stack...
Questions
question
Mathematics, 10.07.2019 00:00
question
Mathematics, 10.07.2019 00:00
question
Mathematics, 10.07.2019 00:00
Questions on the website: 13722367