Queue, or FIFO, is one of the most common data structures and has built-in implementations in many languages ββand frameworks. However, there seems to be little consensus on what the main operations of the queue should be called. An overview of several popular languages ββshows:
- Python: put / get
- C #, Qt: enqueue / dequeue
- Ruby, C ++ STD: push / pop
- Java: add / remove
If you need to implement a queue (say, in some embedded platform that no longer has an implementation of its own queue), what naming convention would be best? Enqueue / dequeue seem most explicit, but verbose; put / get is concise, but gives no hint as to the nature of the FIFO operations; push / pop seems to imply a stack operation instead of queue operations.
terminology data-structures queue naming-conventions
SytS
source share