Introduction to Data Structure and Algorithm

In this section, we will give you the basic idea about the data structure, its types, uses with examples and different types.

What do you mean by Data Structure?

Data Structure means how you store by structuring your data in specific format to get access to it faster and that allow us to perform any action efficiently. Let’s understand this by some examples:

Suppose we have some number to store and we are arranging them in this way shown below in the picture.


The above structure where numbers are arranged one after another is called Array.

Now, let’s say you need to find an element with value of “5”.

To get the element “5”, you need to start search the array structure starting from 1st element till you get the element “5”.

Here, you get element “5” in 4 number of try. Element “10” in 2 number of try and so on.

No of try

Now, let’s arrange the above numbers in another structural way shown below:

tree iteration

The above structure is known as tree. (You can read about tree here in details)

Now, you can access the element “5” and “10” in 3 and 2 number of tries.

No of try 1

Conclusion: In both case, data elements are same, we just changed the structure format to arrange the data and 2nd structure was very much faster in accessing any element comparison to the 1st structure. So that’s what is the data structure where we structure the data in specific format to access it faster.


Types of Data Structure

Data Structure can be categorized into two groups:

  1. Primitive or Built-in data structures: As discussed above, anything which store and structure your data can be called a data structure, so all the primitive or in-built data type are themselves a data structure.
  2. User-defined data structures: These are user-defined complex data structure which structure large and connected data in such a way that it can be accessed efficiently.Data Structure Types


What do you mean by an Algorithm?

An algorithm is a finite set of instructions or logic, written in order, to accomplish a certain predefined task. You can think of a programming algorithm as a recipe that describes how to do something, and your computer will do it exactly that way every time.

However, it’s important to note that a programming algorithm is not computer code. It’s written in simple English (or whatever the programmer speaks).

For Example: Write an algorithm to add two numbers entered by user.

Step 1: Start
Step 2: Declare variables num1, num2 and sum. 
Step 3: Read values num1 and num2. 
Step 4: Add num1 and num2 and assign the result to sum.
        Sum = num1+num2 
Step 5: Display sum 
Step 6: Stop

Well, as discussed, an algorithm is not the code itself, it just describes the steps to perform a task in simple language (here English). The above algorithm can be converted to the preferred programming language developers are familiar with.

An algorithm is said to be efficient and fast if it takes less time to execute and consumes less memory space. The performance of an algorithm is measured based on the following properties:

  1. Time Complexity: Time Complexity represent the amount of time required by the program to run till its completion. It’s generally a good practice to try to keep the time required minimum, so that our algorithm completes its execution in the minimum time possible.
  2. Space Complexity: It’s the amount of memory space required by the algorithm, during its execution. Space complexity must be taken seriously for multi-user systems and in situations where limited memory is available.

In this article, you have learned the following concepts:

  1. What do you mean by data structure?
  2. Type of data structure?
  3. How data structures help in performing different operation like searching etc.
  4. What do you mean by an Algorithm?


So, it was all about Data Structure and Algorithm, if you have any query then please comment below and let us know. If you liked this article, then please follow us on Facebook to get notification for new posts.

Happy Learning 🙂

Rahul is a Data Geek, technology enthusiast, a passionate writer, thinker with passion for computer programming.  He loves to explore technology and finds ultimate joy when writing about trending technology, geek stuff and web development.