It’s a simple concept but one that’s tough to visualize — FIFO (First-In-First-Out) data structure. Before writing lines of code directly into your compiler, visualize your queue using some at-hand tools. Read the steps below to see how.
Write each set of data on a Post-it® Super Sticky Note or Post-it® Page Marker, and then place them on a sheet of paper in the correct order. Keep in mind how they will be stacked up in the queue—first in, first out.
Then, so you can visualize the order in which the data leaves the queue, pull each Post-it® Super Sticky Note or Post-it® Page Marker off the sheet in the correct order. Remember, the first element added to the queue should be the first one to be removed. Our example uses simple numbers, but this idea can be used with much more complicated data sets.
Visualizing items stacking up in your queue - and then visualizing them leaving the queue - can be a useful tool when learning to code. It’s a simple idea that helps make it easy and fun to learn.