Challenge 06 - Implementing a Queue in Go Image Challenge 06 - Implementing a Queue in Go

👋 Welcome Gophers! In this challenge, we are going to be implementing some of the basic functionality of the Queue data structure in Go.

This is going to be the first of a number of data-structure questions which may come in handy if you are about to go in for an interview!

We’ll be carrying on the theme of flying from the previous challenge here and implementing 3 crucial methods needed to support a basic implementation of a Queue.

Push

The first challenge will be to implement the Push function of our Queue data structure.

This method will take in a Flight and push the flight onto the back of our Items queue.

Peek

The second part of this challenge will be implementing the Peek function.

This method will allow us to view what item is at the front of our queue but not modify the underlying stack values.

Pop

The third and final part of this challenge will be implementing the Pop function.

This method will allow us to pop an element off the front of our Items queue and return to us the first flight.

See the Solution

Feel free to have a look at the forum discussion thread for this challenge and contribute with your own solutions here - Challenge 06 - Implementing a Queue

Further Reading:

If you enjoyed this challenge, you may also enjoy some of the other challenges on this site:


Other Challenges