Tutorials

Data Structure Basics


DS Introduction


Suppose you are given 1000 books of different subjects to store.

You received the books and placed them in a room in unorganized manner.

Now if somebody asks you to give science book named 'ABC'.

 

What challenges would you face?

  • As you stored your books (data) in unplanned manner, you may need to traverse through all of the books (data) randomly to get the desired book.
  • Your search time may be less or more depending on your luck. 
  • If you happen to luckily get the book in the very first attempt its well and good. This will be the best case.
  • In average case you may get the book 'ABC' after you have traversed through 400-600 books
  • In worst case you may get it in the last.

But had you placed it in organized manner, just like in Library, you would not have to depend on your luck.

You would have went through an organized and well planned strategy to search the book and would have got it probably saving lot of your time.

 

Library follows data structure mechanism to organize, store and retrieve the books.

This why data structure becomes really important.

It allows to store data (say, book) in planned manner so that it can be retrieved and again placed in proper and planned way.

  

Writing effective program requires proper usage of appropriate data structure. 

 

Thus recognizing and choosing a proper data structure is a very important and critical task. Reason being data structure has huge impact on both the structural and functional nature of the program.

Before we proceed always remember:


Program = Algorithm + Data Structure

Data Structure focusses on following things:

  1. Organizing data
  2. Defining the proper access method for the stored data
  3. Degree of associativity between data's

Data structure is the mechanism of organizing and storing the data properly and establishing the relationship between data stored. Whenever required these data can be searched, retrieved, sorted, or perform other operation without much effort.  

How to choose proper data structure?

Answering this question is really important before we move ahead.

 

Data Structure acts as a base along with algorithm for any program.

 

So data structure selection should be based on following criteria:

  1. Data Structure should be simple and easy to use.
  2. Data Structure selected should be able to reflect the relationships that exists between data.
  3. Data Structure should allow to access, store, sort, search data in convenient manner.


Please Share this page
Views : 305
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!