0
Why do we use circular array concept for implementation of queue using array
7 odpowiedzi
0
do mean why or how?
0
Why because I know how we do this thing
rear = capacity - 1
and then insert element at (real +1%capacity)
0
to access the last element, if u don't know it's current size/ length. (if I understand your question correctly)
0
Yes, we do this. So we can use our normal concept when we use normal queue
0
?? if it's 'circular' then it can't have a 'rear', so how can you "insert element at (real +1%capacity)"
Are talking about deque?...it does have a 'rotate' method which I suppose could be used as a circular array.
Is there an actual container "queue" in python as you can implement it using deque with appropriate method.
I'm sure thats why there's no 'stack' as you can just use append() and pop() with 'list'?