DATA STRUCTURES & ALGORITHMS
When you are organizing a set of data for programming and subsequent analytics, there is a need for storage of data in such a way that they can be easily accessed. It is just like when the filing system in an office. The presence of the file cabinets well arranged and labelled, makes it easy for anyone trying to call up any particular document to simply go to the place where that document (either by classification or in order of nomenclature) had been filed. This is also how data structures word.
In programming, one would need to arrange the various data available to him/her in terms of data structures so that it would be very easy to call those structures up when needed. Take Python programming for an example:
We have 2 types of Data Structures in Python programming:
- PRIMITIVE DATA STRUCTURES: They are basic data structures for assigning values to data in python. They include: Integers (positive and negative numbers e.g. 1, 5, 38, -45); floats (decimal numbers e.g. 4.0, 3.8); strings (sequence of characters enclosed within a pair single or double quotes e.g. ‘Joshua’, “envelope”, ‘I am a boy’); boolean (these are data structures which can hold the TRUE and FALSE statements e.g. x = 7, w=3, x + w ==8, will print “FALSE”). NOTE that you can convert one data structure to another, but that is subject for another time.
- NON-PRIMITIVE DATA STRUCTURES: These are the more advanced members of the Data structure family. They are broadly divided into 3: Arrays, Lists and Files. Arrays are a more compact way of collecting data of t he same type together. They are more popular in C++ and Java than in python programming. Their major distinctiveness from the List data structure is that in array, the programme recognizes and treats all the individual items as the dame data type. You can learn more about arrays by clicking here. Lists are a little bit more advanced than arrays. In Lists, items of different data types can be brought together. e.g. birthNAME= [Emeka, James, Andrew, Joshua, Obodozie]. The List data structure can be further classified into Linear data structures (Stacks and Queues), and Non-linear data structures (Graphs and Trees). Files are important data strictures in programming, as any programme or programming language that cannot read files is of little or no use since the world of Big Data deals with files (.csv, .xls. .doc, etc.) Thus, being able to open, read write and work on files is an important part of programming.
There are other data structures not mentioned above such as Dictionary, Tuple, Sets, etc. You can click here to read more about them.
ALGORITHMS are an essential part of programme writing in which a set of step-by-step instructions are issued in order to arrive at a desired output or outcome. Like the cooking recipe used in our kitchens, algorithms are structured in such a way that following the right set of rules will surely lead to the expected outcome. Most times, the steps followed by the algorithm are hidden from the uninitiated, such that all the end-user needs to do is to insert the required input, while the output will run behind the scene (as programmed) and bring the desired output.
A good example of this is the SEARCH button on our search engines, or the CALCULATE buttons in our scientific calculators, we key in the input and get output; yet, there were certain sets of instructions which they programme followed (behind the scene) to arrive the given output.
Algorithms by nature must be simple, feasible, finite, independent, having options for input and output. For more on how to write algorithms, click here.