Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

QUESTION

(a) Give the representation of a queue as an abstract data type.

(b) What is a priority queue? Give two types of priority queues.

(c) The following program does the following:

1. Create a queue, q, consisting of 1 (front), 2, 3, 4 and 5 (rear).

2. Display the contents of q.

3. Remove an item from q and display the content of q.

#include

#include

#define MAXQUEUE 6

#define TRUE 1

#define FALSE 0

struct queue

{

int items[MAXQUEUE];

int front, rear;

};

void initialize();

int empty();

void insert();

int rem();

void output();

int n;

void main()

{

struct queue q;

int i,E;

initialize(&q);

printf("Enter the number of elements: ");

scanf("%d",&n);

If (n

{

for(i=0;i

{

printf("Enter an element: ");

scanf("%d",&E);

insert(&q,E);

}

}

else

{

printf("Number of elements must be less than MAXQUEUE.\n");

return;

}

printf("\nContent of the Queue from Front to Rear: ");

output(&q);

rem(&q);

printf("\nContent of the Queue from Front to Rear: ");

output(&q);

}

Write the functions initialize, empty, insert and rem in C.

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9586299

Have any Question?


Related Questions in Computer Engineering

Question why most of the researchers in the field of arabic

Question : Why most of the researchers in the field of Arabic text classification collected their own corpus and what is In-house Arabic corpus. The response must be typed, single spaced, must be in times new roman font ...

Sql for databasebuild a query of all students on athletic

Sql for database Build a query of all students on athletic scholarship. Additionally, produce a report with descriptive report and column headings. Be sure there is enough data to prove the selection and sort worked as r ...

Question have you received emails like thesewhat actions if

Question : Have you received emails like these? What actions, if any, have you taken to limit the permissions of the sender? Why or why not? In your chapter reading, you learned about the CAN-SPAM law From your perspecti ...

Whats your answer about the equilibrium change from an

What's your answer about the equilibrium change from an event which decreases both demand and supply? You don't need to provide graph here. Just describe the curve shifts and how the equilibrium price and equilibrium qua ...

Start your c development tool and view the swatthebugs16cpp

Start your C++ development tool and view the SwatTheBugs16.cpp file. The file is contained in either the Cpp7\Chap05\Swat TheBugs16 Project folder or the Cpp7\Chap05 folder. (Depending on your C++ development tool, you m ...

Question suppose you want to implement a sudoku game that

Question : Suppose you want to implement a Sudoku game that includes nine rows and nine columns of squares. Which layout would be the best one to use and why? The response must be typed, single spaced, must be in times n ...

State the required answer precisely and then provide proper

State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. Provide examples and state precisely the meaning of the following features supported by ...

How to response to those 3 following questionsrational

How to response to those 3 following questions Rational Agent ( Artificiall intellegence) 1. There can be more than one agent program that implements a given agent function. (If you agree, provide an example; otherwise a ...

How is international trade regulated what is involved in

How is international trade regulated? What is involved in "trade agreements"?

A student goes to the library let events b the student

A student goes to the library. Let events B = the student checks out a book and D = the student checks out a DVD. Suppose that P(B) = 0.52, P(D) = 0.85 and P(B AND D) = 0.05. Find P(B|D). Give your answer as a decimal ro ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As