Algorithm Design and Data Structure Techniques: Things to know.
Learning how to code can be intimidating. I feel like learning coding is similar to learning a new language. You must know how to read and write according to whatever compiler you are using. The best thing I have learned that has worked for me has been breaking down different aspects of a code and learn them separately, then finally putting them together. One of the biggest obstacles I have come across has been algorithm design.
Algorithm Design
An algorithm is a set of instructions that are followed and used to complete and task or solve a problem. Algorithms have steps that must be followed in the order that they a written. If not, the task or problem may not be completed or fixed successfully. Think of baking a cake, the recipe and steps for preparing the cake is an algorithm. If the recipe is not followed correctly, then the cake will not come out right. Algorithm Design is the method or process used for solving a problem or completing a task.
There are many different types of algorithms. The type of algorithm that is needed will determined by the type of problem that is needing to be solved. Loops and recursions are types of algorithms that can be used to complete tasks that require multiple steps. Search and sorting algorithms can be used to organize list and data within the program. These are just a few types of algorithms that are out there.
When designing my own programs, I rather use loops over recursions. If not used correctly, both types of algorithms can cause major problems within a program. Loops work better for me due to the experience I have with them compared to with recursion. Loops' logic is more direct as an exit can be determined withing the algorithm rather than changing the value of the recursion call. Between searching and sorting algorithms, understanding sorting algorithm should take priority between the two. Even though searching a list can be done on an unsorted list, most search algorithms require the list to be sorted in order for them to work.
I have mentioned lists multiple times in this post. What is a list? A list is a type of data structure. Well, what is a data structure? Data structures are storage that is used to store and organize data. Data structures, like algorithms, are very important in coding. Also, like algorithms, there are many different types of data structures. Linked list, arrays, queue, and stacks are all examples of data structures.
List is a type of data structure that is used in Python. A linked list is used in Java that has the same characteristics as a list in Python. I prefer linked lists over other types of data structures simply based on their functionality. Elements can be added and removed to a linked list at any position within a list. Queues and arrays only allow elements to be added to one end of the data and removed either from the same end they are added or from the opposite end. Since I tend to write programs where the data is being updated constantly, a list would be a better option for me.
Conclusion
I hope that this post can help any coders that are learning the art of coding. To be good at anything in life you must practice. This is true in coding as well. I have given some examples of techniques I use that work for me. I recommend that you use my techniques and combined them with your own and others to develop your own way of coding. Even after I have written a successful code that I have a good understanding of, I still like to study other people's codes that have the same output as mine. It helps me to expand my thinking and approach future codes from different angles.
Byron
Comments
Post a Comment