You are here:Home » DATA STRUCTURES » Data Structure and algorithm

Data Structure and algorithm

Lot's of students face problem in understanding data structures. So I decided to write on this subject. I will try to make data structure as simple as possible but if there is any simpler way to understand concepts in data structure please do tell me by commenting. I'll appreciate your effort and your feedback will help me to make this content more understanding. Before knowing data structure we should be familiar with a term called algorithm.

So what is an algorithm? An algorithm is a finite step-by-step list of well defined instruction to solve a particular problem. Let's understand algorithms by a simple example:

algorithm example

What is the purpose studying algorithms?We study algorithms to make a action plan to complete a particular task. 

So what is this term data structures? A data structure is a specialized format for organizing and storing data. General data structure types include the array, the file, the record, the table, the tree, and so on. Any data structure is designed to organize data to suit a specific purpose so that it can be accessed and worked with in appropriate ways. In computer programming, a data structure may be selected or designed to store data for the purpose of working on it with various algorithms. In simple terms we can say "a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently".

Why do we study data structures?We study data structures so that we can learn to write more efficient programs. But why must programs be efficient when new computers are faster every year? The reason is that our ambitions grow with our capabilities. Instead of rendering efficiency needs obsolete, the modern revolution in computing power and storage capability merely raises the efficiency stakes as we computerize more complex tasks.Creating efficient programs has little to do with “programming tricks” but rather is based on good organization of information and good algorithms.A programmer who has not mastered the basic principles of clear design
is not likely to write efficient programs.

Why a programmer should have thorough knowledge of data structures?
1. Each data structure and each algorithm has costs and benefits. Practitioners
need a thorough understanding of how to assess costs and benefits to be able
to adapt to new design challenges. This requires an understanding of the
principles of algorithm analysis, and also an appreciation for the significant
effects of the physical medium employed (e.g., data stored on disk versus
main memory).
2. Related to costs and benefits is the notion of tradeoffs. For example, it is quite
common to reduce time requirements at the expense of an increase in space
requirements, or vice versa. Programmers face tradeoff issues regularly in all
phases of software design and implementation, so the concept must become
deeply ingrained.
3. Programmers should know enough about common practice to avoid reinventing
the wheel. Thus, programmers need to learn the commonly used
data structures, their related algorithms, and the most frequently encountered
design patterns found in programming.
4. Data structures follow needs. Programmers must learn to assess application
needs first, then find a data structure with matching capabilities. To do this
requires competence in principles 1, 2, and 3.

What is the relation between an algorithm and a program?Look at an algorithm as a formula for working something out. A program is a series of instructions for the computer that uses algorithms to execute the desired task. Let's understand this through and example:
Simple algorithm Area of rectangle A = length times Depth
Program to work out area would be
Ask user to input length
Ask user to input depth
Use area algorithm to calculate area
Display answer

So what is the relation between data structure and algorithm? Data structures use algorithms for its different operations like sorting, searching, inserting, removing, and overall manipulation of their respective data.

What is the relation between data structures,algorithm and programs?
Algorithms +   Data structures = Programs.This simple yet powerful expression  very aptly defines the relationship between the three above mentioned terms.

That's all for this post and in the next post we will learn about control structures and complexity of algorithms.

2 comments:

  1. Online course. Learn how to develop a recurring subscription food delivery app like doordash, Blue Apron, hellofresh with core functionalities from scratch. It can be for any subscription bases business. You don't need to learn everything about HTML, CSS, Javascript or Ruby on Rails to just create a web application. With step-by-step code along lessons, you can learn the important things to build an app for your coding project or even your own startup. It can get you building something REAL quickly and efficiently. (Ideal for entrepreneurs and founders) https://plantoost.com/courses/build-a-meal-kit-delivery-web-app-ruby-on-rails-stripe

    ReplyDelete
  2. Hello there! I simply wish to offer you a major approval for your incredible data you have here on this post. I will be returning to your site for all the more soon. tech updates

    ReplyDelete