1,561 views
0 votes
0 votes

I'm learning data structures from a book. In the topic, Circular Queue using Dynamic Array, the author has mentioned below point,

Let capacity be the initial capacity of the circular queue,We must first increase the size of the array using realloc,this will copy maximum of capacity elements on to the new array. To get a proper circular queue configuration, we must slide elements in the right segment(i.e, elements A and B) to the right end of the array(refer diagram 3.7.d). The array doubling and the slide to the right together copy at most 2 * capacity -2 elements.

I understand array doubling copies at most capacity elements. But how does array doubling and slide to right copy at most 2 * capacity -2 elements??

Please log in or register to answer this question.

Related questions

1 votes
1 votes
2 answers
1
srestha asked Oct 29, 2017
2,782 views
The initial configuration of circular queue as followsWhat is status of states of queue contents after the following sequence of stepsenqueue xdequeueenqueue ydequeuedequ...
0 votes
0 votes
0 answers
2
target2017 asked Jan 21, 2017
962 views
Doubt: dequeue really deletes the element or just moves the pointer? I'm not getting the answer.
2 votes
2 votes
1 answer
4
Xylene asked Aug 21, 2017
2,022 views
a)a_cb_b)_abc_c)abc_ _d)_ab_c