Introduction to Data Structures

What is a data-structure?

Data is basically any piece of information. Now, how you store that piece of information and access it efficiently is what is called a "Data structure". You would be thinking something like that would be easy right, but, to be honest, it is kinda difficult because of the variation in the algorithms. Data Structures and algorithms go hand-in-hand but are different.

Let's say you are searching through a list of numbers. The list of numbers is the data structure used whereas the searching process defines the algorithm. If you change the data structure to a tree-like structure, then the algorithm that is the way you search also changes accordingly.

In one line, I would define data structure as how you store, organize and manage the data.

Examples of Data structures are Array, Linked list, Stack, Queue, Binary tree, Binary Search tree, Heap, Hash, Graph, and there are more too that we will learn along the way.

Types of data that can be stored are integers (byte, short, int, long), decimals ( float or double), Boolean values( true or false), characters(char), text (String).

Before going further, let's talk a bit about memory. Memory in a computer is basically cells in computer hard drive or RAM. If someone asks you what your memory power is, what it means is how much data can you store. Now, if you go to someone who has very high memory power and ask him/her what their secret was, they might say, "I record all the facts and form a whole story of my own, this way I relate everything, go in sequence and not miss anything". Believe it or not, this is kinda true for computers too but in a different way. How you store your data effects how you access your data. The better way you store it, the better and efficient way you access it.

The choice is yours, you can store a list of numbers in an array (continuous) or in a binary search tree which reduces the search time by almost half or less.