Algorithmic Design and Data Structures For Newbies
Hello, fellow loons!
If you're here, it's because you have a hunger for more knowledge like me, so just know you're in a welcoming space! For this week's blog post, we're going to get into some of the basic ideas and ways to approach algorithmic design to build programs you can be proud of! Planning your approach to algorithmic design is no different than planning anything else. It involves organizing the tools you have at your disposal in a way that provides the easiest path forward to what you're trying to achieve.
Algorithmic Design: The Plan for the Plan
While that header may seem a bit redundant, it's also appropriate. An algorithm itself is a list of step-by-step instructions meant to solve a problem. The type of problems it can solve is only limited by your ability and imagination. Think of it as a recipe. With that said, think of algorithmic design as gathering the ingredients you have to figure out what kind of recipe you can make and plan for it. This process can be broken into simple steps. Below, I've listed the steps I will usually take to get started with something like this.
- Figure out the Problem: In order to have any chance at having good organization to solve a problem, we first must know what the actual problem is. We need to know what we want our output to consist of, what parameters it needs to follow, and what the expected input to get there would be.
- Break Down the Problem: As with most problems that are complex, it can be overwhelming to tackle all at once. Generally, the best practice is to break it down into smaller problems that will each have their own algorithm to serve them.
- Pick a Strategy: There is usually more than one way to solve most problems, so at this stage, we need to decide how we're going to approach things. If it's something simple, we want our approach to be direct and simple as well. This ensures we're efficiently using our resources.
- Write the Code: Now that you've decided on your strategy, it's time to write down the steps or path your program needs to take to come to your solution. This must be precise, which is the reason for our next step.
- Test, and Test Again: Once you've completed your algorithm, you need to begin testing it with all the possible inputs you can think of to ensure it behaves properly. The last thing you want is someone asking your program a question in a way it isn't prepared to answer properly. If you find that something can be done more efficiently, or something that needs to be corrected, now will be the time to adjust and refine to ensure a working and worthwhile final product.
- Dictionaries/Hash Maps: Think of this as a normal dictionary. You look up a specific word in order to find its definition or the associated information.
- Linked Lists: A change of items where each item holds a set of data and a link to the next item in the chain. These are good for situations where something needs to be added or removed easily.
- Arrays: Think of a row of labeled boxes at a garage sale. If you know what you're looking for, it's easy to access it as long as you are familiar with the labels on the boxes.
- Prioritize: Time Efficiency- Some algorithms simply take less time to complete the same task. If you were searching for an item in a sorted list, you would want to use a binary search rather than a linear search because it's much faster.
- Prioritize: Space Efficiency- There are data structures that use less memory despite being the same or even a larger amount of data. Choosing the right data structure or "container" for data is can be incredibly important in systems with limited resources. If you had a fixed amount of something you were searching for, an array might be more efficient than a linked list when it comes to space due to the need for extra memory in a linked list.
- Prioritize: Ease of Use- An algorithm or data structure might be the best choice based on ease of use rather than efficiency or speed. If the algorithm is more complex, it may not be worth the time and effort to implement if the end goal is much simpler and easy to execute with a simpler program.
- https://www.geeksforgeeks.org/best-data-structures-and-algorithms-courses/
- https://dev.to/ayabouchiha/free-resources-to-master-algorithms-data-structure-2nfj
Comments
Post a Comment