Why are data structures and algorithms so important in computer science?
Data Structure :
A data structure is a particular way of organizing and storing data in a computer so that it can be accessed and modified efficiently. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.
1) Take some input
2) Process it
3) Give back the output.
The input can be in any form, for eg while searching for directions on google maps, you give the starting point and the destination as input to google maps, while logging in to facebook, you give your email and password as input and so on.
Similarly, in the third step, the computer application gives us output in some form or the other.
To make this process efficient, we need to optimize all the three steps. As you can guess, the most we can optimize is the 2nd step, which is where we have Data structures and algorithms.
Data structures refers to the way we organize information on our computer. With a slight thinking , you can guess that the way we organize information can have a lot of impact on the performance. Take for example, a library. Suppose, you want to have a book on Set Theory from a public library, to do that you have to first go to the maths section, then to set theory section. If these books are not organized in this manner and just distributed randomly then it will be really a cumbersome process to find a book on set theory.
This is the way a librarian organizes his books(data) into a particular form (data structure) to efficiently perform a task(find a book on set theory).
In this manner we computer scientist process and look for the best way we can organize the data we have, so it can be better processed based on input provided.
What actually is a computer?
A machine that:
- Takes some input
- Process that input
- Output the result
- Stores that
Algorithms are everywhere. Anything you do, can be broken down into small steps and that is the Algorithm. Suppose you want to find a word from a Dictionary. Algorithm involved is:
1/ Find the Dictionary
2/ Search for the word
3/ Look for meaning once you found the word.
4/ In the above steps, searching can be broken down further.
- Now what is a data structure?
Data Structures helps to store data efficiently. A dictionary stores words. And just think if thew words were stored in a random order, it would have become impossible to find a word from the dictionary
The dictionary stores words in Alphabetical Order. This is the data structure a dictionary follows. The algorithm for searching a word in a dictionary is called Binary Search
Top comments (3)
Seems like a nice article ngl :)
Thank you for this simple and nice intro to Data Structure 😉😊🚀
sounds wonderful! I will keep trying!