Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A Queue of chars ( characters )Data structure is given below as shown in the diagram. In this Circular Queue implementation is done in such

A Queue of chars ( characters )Data structure is given below as shown in the diagram.

In this Circular Queue implementation is done in such a way that the rear circles to the front of the array if there are empty slots in the front and a reserved spot is used as the front before the first element to differentiate between the front and the rear.

Front of the Queue is index 2 and rear of the Queue is index 13. Following are the alphabets occupying the following indices.

H - 3; A - 4; P - 5; Y - 6; M - 7; I - 8; D - 9; T - 10; E -11; R - 12 and M - 13.

Four new entries decide to join the Queue.

E

X

A

M

E comes in first, X next, A next and M next.

1) Where will these values go be placed in the Queue? Just state the alphabet and the index of the array where each of these characters will be placed in the Queue.

( So for example if E goes into index n ( a number) Just say E - index n.)

Assume that no alphabet leaves the Queue during this time and only addition takes place. Also assume that in this approach rear can circle around to the front.

2) After these alphabets are added in the Queue what index will be the front and rear of the Queue pointing to?

3) Now imagine one alphabet is Dequeued ( or removed from the Queue) before adding E X A and M. Where will be these new values added and state which index does the front and rear of the same Queue would be pointing to?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago