Smartick Try it for free! Abrir el Menú Móvil Try it for free!
Accelerate your child’s learning
Smartick is a fun way to learn math!

Jul27

Data Structures in Programming: Lists

In programming, data structures allow us to store information in an orderly fashion. They help to properly organize data to solve more complex problems or to do it in a more efficiently.

In previous posts, we talked about data structures in programming, specifically arrays and matrices. Today we will look at another type of data structures: lists.

Data Structures: Lists

Lists, like other structures in programming, also allow us to store multiple data. This is the case of variables such as INPUT and OUTPUT, which are – and have always been – lists! From now on, lists are now available, as another structure, within the lab.

Normally a list could grow dynamically but, because our lab has very limited space, we have kept its size fixed. Nevertheless, the lab lists are still very useful for storing and processing data easily, thanks to their special commands: pick from and put.

Now that we are going to work consciously with lists, the options of the “Pick from” and “Put” blocks have increased. We will be able to pick from or put in data at either at the end or the beginning of a list.

To make it easier to recognize, we have marked the beginning and the end of the lists with the letters of the Greek alphabet, Alpha α and Omega Ω. This way it will be easier to recognize each end and to take out or put data where it is most convenient.

Lists are another type of data structure

With this approach, we can use the lists that best suits each mission, pulling and putting data with different combinations. The order in which we process the data will be affected by the combinations chosen. For example, if we put and pick from different ends, the lists in the lab will act as a Queue. If we do it at the same end, as a Stack. Queues and Stacks are also classical data structures, which, are used in this way in the laboratory.

We have mentioned that the INPUT and OUTPUT are also lists. However, to avoid certain combinations, we have restricted the interaction with the end (omega) of the INPUT. The OUTPUT ends are fully available.

In the case of arrays, we can access data at specific positions as long as we use their index correctly.

However, the lists we are almost always used to traverse and process.  For these actions, we also still have the “As long as there is” loop, but now we can choose the list we want to control.

 

Some missions will ask us to go through a list while, or until, a certain condition is met. In that case, it is important to construct the condition that accompanies the “While” loop correctly. Whether it is negative or not, will completely change the way the data in the list is processed.

In programming, you have to use your wits. At this point in the syllabus, it is still essential to understand the mission, but that alone is no longer enough. There may be several solutions to the same problem, or different intermediate processes may be necessary to sort or identify certain data before tackling the actual mission.

Remember that lists are very useful for sorting and storing data. You can use variables and all the data structures you already know to help you come up with a solution efficiently.

In programming, it is very important to try new things, to experiment, and at this point in the lab curriculum we have many tools that we can use to test things out. This is how you learn best: you try something, it doesn’t work as you expect, analyze it, change it and try again. Failing is not something negative, it is part of the learning process. Moreover, knowledge is infinite.

If you want to continue learning mathematics, programming and much more, all adapted to your level, visit Smartick, sign up and try it for free.

Learn More:

Fun is our brain’s favorite way of learning
Diane Ackerman
Smartick is a fun way to learn math
  • 15 fun minutes a day
  • Adapts to your child’s level
  • Millions of students since 2009
Share on FacebookTweet about this on TwitterShare on LinkedIn
Smartick

Add a new public comment to the blog:

The comments that you write here are moderated and can be seen by other users.
For private inquiries please write to [email protected]

Your personal details will not be shown publicly.

I have read and accepted the Privacy and Cookies Policy