MCPcopy Create free account
hub / github.com/algorithm-archivists/algorithm-archive / enqueue

Function enqueue

contents/tree_traversal/code/c/utility.h:83–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83void enqueue(struct queue *q, void *element) {
84 if (q->front == (q->back + 1) % q->capacity) {
85 queue_resize(q);
86 }
87
88 q->data[q->back] = element;
89 q->back = (q->back + 1) % q->capacity;
90}
91
92void *dequeue(struct queue *q) {
93 if (queue_empty(q)) {

Callers 1

bfs_queueFunction · 0.70

Calls 1

queue_resizeFunction · 0.85

Tested by

no test coverage detected