Categories
Computer Science

Hello World

Sounds cliché, but as almost every developer learns a new programming language by printing out “Hello World” as output, I will also start this blog with the first post being a “Hello World” post.

I am pretty excited about starting this blog as I have a lot of things to write about. I think I’ll probably start off with the topic of stacks and queues this week then move on to something else next week. 

In terms of writing about stacks and queues, I’ll implement the stacks and queues in Python using both a list and a linked list. We will then test run times and then figure out which implementation is best for each scenario. 

Well, I have nothing else to say, so I might as well begin by talking about stacks and queues. I don’t know if it was just me, or if this applies to a lot of people as well, but when I first learned about stacks and queues, I couldn’t seem to understand what was so fundamentally important about them.

Queues are just like lines that form when checking out at a grocery store (first person in the queue gets taken care of first), and a stack is just something like books stacked on top of other books (the uppermost book on the stack is the first one to be reached). 

So, what is of so much significance with these data structures? Well, it turns out that they solve a lot of things that I couldn’t personally intuitively think of. 

Take queues for example, when you’re running tasks on your computer, they’ll run based on the order that you executed the tasks. This is the simplest form of a queue. The tasks run on the order that they were ordered to execute. So, the first task executes, then the second, then the third, and so on and so forth.

How about stacks? Well, as opposed to a queue, the last thing to be added is the first thing to be taken care of. In terms of an example of a stack in computers, think about a browser’s history tab. When you click on the left arrow to go to the previous page on a browser, you’re essentially using a stack. The last page that was added to the order of pages would be the page that you would travel to. You would have to iterate all the way through the stack to get to the beginning of your tab (which would probably be your home page). 

Well, that should about do it for the first post. In our next article, we’ll discuss how to implement a stack and a queue with Python. I’ll most likely divide them into two articles with one covering stacks and the other coving queues. You might wanna grab coffee or some beverage of your choice before you dive in. It’ll be much longer than this first post. 

Leave a Reply

Your email address will not be published. Required fields are marked *