An algorithmic view of to-do lists [Advice]
Tags: productivity, organization, algorithms
Published: 2022-06-16 00:26:41

Everyone of us knows a person that has trouble managing all their tasks. Yet, some people prefer to try to remember it all and do not use to-do lists. Is it algorithmically efficient? I thought of it for fun and here are my thoughts!

## Time complexity
If you’ve to do some tasks and you don’t have written them down, you need to remember them to do them. Some people may think that they only have to remember the task they are going to do immediately after, which would be a O(1) (constant) time complexity each time I want to do a task and O(n) (linear) time complexity to finish all my tasks. This would be true if it wasn’t because of two little killjoy devils that ruined your party: Tasks priority and leisure time calculations.

When you are going to do a task, you logically have to choose a task to do. However, can you choose tasks that you don’t remember? Certainly not. You can’t read a variable that hasn’t been created before. As a consequence, you’re going to have to remember all them in order to choose the next activity you’re going to do.

What about just choosing the first task that comes to my mind? Well, this kind of FIFO approach it’s not efficient with tasks that have different priority. Following this system, if you have to do an important task, but you remember an irrelevant task first, you’re going to do the irrelevant one first and you may not have enough time to do the important one. Therefore, this is not a possibility.

Additionally, what happens when you want to take some spare time to relax and maybe listen to music? Well, you have to know if you have enough time for it, don’t you? This will require your brain to load all the data and evaluate it on runtime.

Thus, you’re not going to be able to know what to do in O(1) (constant) time complexity, but in O(n) (linear) time complexity. Doing this n times will take you O(n²) time complexity. It can be done with a few tasks, but, as we know, this approach is not scalable.

## Space complexity
Still, doesn’t a to-do list increases the space complexity? Well, not at all. Both of them have a O(n) space complexity. Although you don’t need a physical space to save your to-do list, the data isn’t stored in the air and database developers know what I’m talking about. That space is in your mind, it’s called your memory, and usually runs full of things. In fact, it’s very unsafe memory. Once it doesn’t have more space or just by luck, it will delete your tasks to replace them with new memories you have.

In contrast, saving them in your to-do list is a lot safer and won’t get erased from one moment to the other. Nowadays, it is even easier with all the tools that have appeared to help you rganize your tasks. What else could you ask for?
## Safety and constraints
Who came from working with languages like C++ are going to be scared when I mention the U and B words. Yet, it’s important to mention that not having your tasks organized triggers Undefined Behaviour. When I say this, I mean that it is not detailed if you will or will not remember your tasks at the moment you must do them. Even if you remember the task, you may forget the details of it. Then, you worry about it and search for a solution. How much trouble you could have avoided by organizing your tasks when you had!

## Final thoughts
In the end, organizing your tasks is up to you. Despite this, if you aren’t used to do it, I strongly advise you to do so! Actually, it is really satisfying looking at your to-do list and noticing how much you have done. A to-do list doesn’t even have to be a very sophisticated thing that is impossible to maintain (I actually have mine in Word and works very well :p). When you’re creating it, just focus on giving it your own style while keeping the purpose of the list.

_<small>This post was originally published on Medium by Gary Strivin' ([link](https://medium.com/@GaryStriving/an-algorithmic-view-of-to-do-lists-89cfd474ab0a).</small>_