logo

Crowdly

Browser

Додати до Chrome

Consider an array implementation of a circular queue. Let the array be named Q a...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Consider an array implementation of a circular queue. Let the array be named Q and be of size N=10, and hence the indices range between 0 and 9, including both. Let the front of the queue be indexed by f and the rear be indexed by r. Initially, when the queue is empty, let f = r = N-1 = 9.

With every enqueue operation, we do r = r + 1 mod N and store the new element at index r of the array.

With every dequeue operation, we do f = f + 1 mod N and remove the element at position f.

What will be values of f, r, Q[f+1] and Q[r] after the following operations?

enqueue 4; enqueue 6; enqueue 2; dequeue; enqueue 3; enqueue 9; enqueue 5; dequeue;

50%
0%
0%
50%
Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.kent.ac.uk?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome