Returns the first element of the queue >>> cq = CircularQueue(5) >>> cq.first() False >>> cq.enqueue("A").first() 'A'
(self)
| 37 | return self.size == 0 |
| 38 | |
| 39 | def first(self): |
| 40 | """ |
| 41 | Returns the first element of the queue |
| 42 | >>> cq = CircularQueue(5) |
| 43 | >>> cq.first() |
| 44 | False |
| 45 | >>> cq.enqueue("A").first() |
| 46 | 'A' |
| 47 | """ |
| 48 | return False if self.is_empty() else self.array[self.front] |
| 49 | |
| 50 | def enqueue(self, data): |
| 51 | """ |