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, 21.06.2019 19:40
Microsoft introduced active directory with windows 2000. in server 2012, it is in now version 4. what are some new features in the new ad that were not present in windows 2000 ad?
Answers: 1
question
Computers and Technology, 22.06.2019 16:10
Drag each label to the correct location on the imagelist the do’s and don’ts of safeguarding your password.keep yourself loggedin when you leave your computer.don’t write your password down and leave it whereothers can find it.share your password with your friends.each time you visit a website,retain the cookies on your computer.use a long password with mixed characters.
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
Write a method named addall that could be placed inside the hashintset class. this method accepts another hashintset as a parameter and adds all elements from that set into the current set, if they are not already present. for example, if a set s1 contains [1, 2, 3] and another set s2 contains [1, 7, 3, 9], the call of s1.addall(s2); would change s1 to store [1, 2, 3, 7, 9] in some order. you are allowed to call methods on your set and/or the other set. do not modify the set passed in. this method should run in o(n) time where n is the number of elements in the parameter set passed in.
Answers: 2
question
Computers and Technology, 23.06.2019 05:00
Acompany is inviting design for its new corporate logo from its users. this is an example of ? a. crowdfunding b. crowdvoting c. crowdsourced design d. crowdtracking
Answers: 3
You know the right answer?
Examine the following declarations and definitions for the array-based implementations for the stack...
Questions
question
English, 12.02.2021 09:10
question
Mathematics, 12.02.2021 09:10
question
Mathematics, 12.02.2021 09:10
Questions on the website: 13722362