menu_book Course Curriculum (Data Structures & Algorithms) expand_more
Complexity & Foundations
Arrays & Strings
Linked Lists
Stacks & Queues
Hashing
Trees & Heaps
Graphs
Circular queue
Learn Circular queue in Data Structures & Algorithms with a focused explanation, a topic-specific example, edge guidance, and a mastery check.
12 min read
•
Intermediate
data-structures-algorithms-035.py
python
buffer=[None]*3; head=tail=size=0
for x in [10,20,30]:
buffer[tail]=x;tail=(tail+1)%len(buffer);size+=1
value=buffer[head];head=(head+1)%len(buffer);size-=1
print(value,buffer,head,tail)
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content