Advanced topics

Queue data structures can be built on several different underlying data structures. Each foundation provides different advantages, and the type that is chosen typically depends on the application's needs. The three most common implementations are array based, linked list based, and heap-based.

Queue data structures are also found in two additional variations, including the double-ended queue and the priority queue. Again, each variation offers advantages and disadvantages and the type that is chosen will largely depend on the needs of your application.

Array-based queues

Array-based queues utilize a mutable array to represent the queue. Both of the examples in Objective-C and Swift take this form. In this implementation, the [0]

Get Everyday Data Structures now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.