1 Data Structures and Algorithms

pcbuck April 22, 2021 0 Comments



My experience learning algorithms and data structures as a computer science


undergraduateIf you want to get something done by a computer, you have to tell the computerhow to do it. You have to write a computer program explaining step-by-stepwhat tasks it has to do and how they should be done. This is where algorithmscome into play.> Algorithms are a set of instructions used by computers to solve a given> problem in order to meet an end goal.Image by Bill Smith from FlickrIn, my experience, learning algorithms is crucial to design and developefficient computer programs. In this article, I would like to share with youmy learning experience in algorithms as an undergraduate student and how ithas benefitted me in my career and academic work.Image by StockSnap from Pixabay

Example 1: Sorting algorithms


Consider that we are making an online shopping application. We want to let theusers view items in the increasing order of price. For this, we have to sortthe items by the price. As a novice programmer, I would add the prices to anarray (or list) with a record of their indices and simply call the array’s in-built `sort()` method. What actually happens inside the `sort()` method? I hadno idea about the exact methods back when I used to make applications.Sorting algorithms are one of the basic topics taught at first in the datastructures and algorithms course at university.After learning about the different sorting algorithms only I realised that notevery sorting algorithm is suitable for every task. They have different timecomplexities and they vary with the size of the data. Most of all, theirrunning times matter a lot when developing applications, even though it isjust a few seconds. Moreover, I got to learn about in-place sorting algorithms(sort elements in place) and out-of-place sorting algorithms (require extraspace to store elements while sorting). These things made me think in-depth onwhat sorting algorithms should I use for a specific application whileconsidering the time and memory constraints.

Example 3: Using lists, sets and dictionaries


Whenever I need to store a bunch of values, I would use a list. Back then, Idid not care whether I need to keep the order or to allow duplicates; I wouldsimply use a list for everything. After I learned about lists, sets anddictionaries, I realised that these can be used in different scenarios, andusing one over another would actually speed up my code. For example, if I wantto check for membership of a value, it is much faster in a set or dictionary(taking constant time) than when using a list (taking time proportional to thelength of the list). Moreover, a list allows you to keep duplicates while aset will not allow duplicates.Image by Gerd Altmann from PixabayThese are a few of my experiences where I started to change my thinking from aprogrammer to a software engineer. I have experienced significant improvementsin the performance of my code when I changed to a suitable data structure orchanged to a faster algorithm.

Learn Programming Concepts


Before learning algorithms in Computer Science, I had a good understanding ofprogramming concepts such as variables, functions, classes and especially,Object-Oriented Programming (OOP) concepts. These concepts act as a foundationto understand more advanced concepts in computer science.

Learn and Understand Algorithms and their Concepts


Apart from my course material, I followed our recommended textbookIntroduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, RonaldRivest and Clifford Stein. You can start with the basics such as * Time and space complexity analysis * Big O notation * Recursion * Basic data structures such as arrays, matrices, linked lists, stacks, queues, trees, etc. * Basic algorithms such as searching algorithms and sorting algorithms.Time and space complexity analysis is a very important topic you have tounderstand in order to analyse algorithms. Then you can move into moreadvanced algorithms such as graph algorithms.Image by Dariusz Sankowski from PixabayThe most important thing to keep in mind is that you have to clearlyunderstand what happens within the algorithm. I used to take simple examplesand apply the algorithm to see what happens in each step. Working out exampleshas helped me to get a better understanding of what happens in the algorithmand I never had to memorise algorithms. If I’m asked to write a pseudocode foran algorithm I can easily relate to an example and work it out, rather thanhaving to exactly memorise each step.

Interactive Algorithm Visualisers


You can try out algorithm visualising platforms such as, 1. Data Structure Visualization 2. Algorithm Visualizer 3. VisuAlgo 4. Sorting Algorithms Animations | Toptal 5. Animated Algorithms 6. Algorithm Animations and Visualizationsthat are available online and understand how algorithms work step-by-step.

1. Programming language and frameworks


It’s not a surprising point that programmers need to know programminglanguages and frameworks. But to be a good programmer, it’s important toknow at least one programming language in depth.It would be pretty good if you have every try to learn another programminglanguage to have a common sense of what are differences as well.Which programming language you will choose to make your main one depends onyou and the issues you want to solve. You can take a look at the ranking ofprogramming languages worth to learn and see if you can select anything thatis in your interest.

2. Databases


In developer work, it’s very important to understand how the database works.It’s the main part of the application where collected data is kept.As a programmer, you should have a basic knowledge like how to create, delete,update, insert a record. And even better if you know how to organize adatabase, which one will be better to use in a particular project and why.Also, you should be able to take care of the security of the data saved in thedatabase.

3. Data structures and algorithms


Algorithms are the sets of instructions that should be executed in a properorder to get the output. Algorithms are not connected directly to anyprogramming language; they are methods of solving certain issues like sortingor search.Taking into consideration that data structures and algorithms are the mostimportant and most checked thing in programmer knowledge, it should be crucialfor every programmer to master these skills.

Things Every Programmers and Developer Should Know


Without further ado, here is a list of things which I personally believe,every programmer should know, irrespective of the job he is doing. These arebasic skills and will serve you for a long time. Any investment made into thisin terms of time, money and effort will help you to reap rewards throughoutyour career.

1) Data Structures and Algorithms


If you want to become a programmer then you ought to know data structure andalgorithms well; there’s no way around it. This is one of the important topicsof any programming job interview and without you knowing basic data structures(e.g. array, linked list, map, set) it’s not possible to write a real-worldapplication.That’s why every programmer should put serious effort to learn data structuresand algorithms during their computer science course.If you are a self-taught programmer, then also you must know data structuresand algorithms; in fact, many programming boot camp will teach you datastructures and algorithms as the first thing.If you want to learn it for yourself then Data Structures and Algorithms: DeepDive Using Java is a good place to start.

8) Programming Languages


As a programmer, you must know a programming language: C++ or Java, or maybePython or JavaScript. You can choose whatever you want to but my personalsuggestion is that you should at least know Java.It’s very easy to start with and that’s why a good choice for beginners. It’salso immensely powerful and allows you to virtually anything.It has got libraries from doing basic stuff like web development to morecomplex tasks with Big Data and so on. If you decide to learn Java then TheComplete Java MasterClass is probably the best place to start with.

Leave a Reply

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