What is Data Structures & What is an Algorithm ? Why do we need Data Structures & Algorithms ?

Understand the meaning of Data Structures & Algorithms in detail in this post. We will study what is a data structure and why we need data structures. We will also take a detailed explanation about what is an algorithm and how it works.

What is a Data Structure ?

Data Structures is one of the most fundamental subject in Computer Science & in-depth understanding of this topic is very important especially when you are into development/programming domain where you build efficient software systems & applications.

Definition –
  • In computer science, a data structure is a data organization, management and storage format that enables efficient access and modification.
In Simple Words –
  • Data Structure is a way in which data is stored on a computer.

Data structure is a particular way of storing and organizing information in a computer so that it can be retrieved and used most productively.

  • Each Data Structure allows data to be stored in specific manner.
  • Data Structure allows efficient data search and retrieval.
  • Specific Data structures are decided to work for specific problems.
  • It allows to manage large amount of data such as large databases and indexing services such as hash table.
YouTube video tutorial –
What is an Algorithm ?
Dictionary Definition –

A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.

Formal Definition –

An algorithm is a finite set of instructions that are carried in a specific order to perform specific task.

Algorithms typically have the following characteristics –
  • Inputs : 0 or more input values.
  • Outputs : 1 or more than 1 output.
  • Unambiguity : clear and simple instructions.
  • Finiteness : Limited number of instructions.
  • Effectiveness : Each instruction has an impact on the overall process.
Real world example of an Algorithm – 

Algorithm(aka process) to make a lemonade –

  1. Cut your lemon in half.
  2. Squeeze all the juice out of it that you can.
  3. Pour your juice into a container with 1/4 cup (2 oz) sugar.
  4. Add a very small amount of water to your container.
  5. Stir your solution until sugar dissolves.
  6. Fill up container with water and add ice.
  7. Put your lemonade in the fridge for five minutes.
  8. Serve and enjoy!
Example of an Algorithm in Programming –

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
YouTube video tutorial –

Leave a Reply

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