The terms Stack and Heap get thrown around a lot in the programming world. But what does it means? What is the difference between them and why should we care?
To start, I would like to make a clarification on a possible misconception. Heap is referred here as a memory allocation technique, not as a data structure. Furthermore, when we speak about Heap as opposed to Stack, we do not mean two types of memory, what we mean is two ways of allocating memory.
When your code compiles (or run if interpreted), the compiler needs to consider how to allocate your variable definitions in memory. To understand this process, let’s first examine the pros and cons of each type of allocation.
If you agree that nothing paints a better picture of your software project like a well maintained UML class diagram, then this post is for you.
I have been fascinated with Golang because of the versatility of the language. I wanted to take advantage of the Golang parser and a great software called PlantUML (http://plantuml.com/) to create a program that will translate my Golang code into a neat class diagram.
One of the most exciting aspects of the software development process is experiencing the steps leading to a pleasing solution to your problem. That moment when, after some time of thoroughly brainstorming, everything falls into place. I had such a moment today, and I would like to share my story.
This morning I was faced with a simple dilemma. I needed to perform a GET request containing a large payload to the server, but I didn’t want to show it in the URL. The reason for the GET request is that I wanted to give the user the ability to download a file with a click of a button. The purpose of the large payload, the requirements for this file. You see, this file is a zip archive that the service will dynamically construct and deliver to the user. The issue is it can potentially contain thousands of files inside, and I didn’t want to clutter the URL with this payload.
That is when it hit me! I have been using Redis for some time now, and I thought this would be a great use of it. With that in mind, I set up to develop the following idea.
Complexity in data structures is defined for each of its actions (access, insert, delete, search) and dictionaries shine on three of these operations. Because of this, they become useful in reducing the complexity of many algorithms when you apply a clever use of them. For dictionaries, accessing, deleting and inserting operations could be achieved quickly despite the number of elements they have. So let’s pick up our headset and get to coding while we listen to smooth jazz (hint hint, Kenny G).
Let’s consider the following problem: Write a function that prints a count of how many times all letters appear in a given string. To simplify the use of dictionaries I will decide to use PHP, but this approach could be seen in almost any language. Continue reading Why I like dictionaries so much?→