What exactly are Data Structures and Algorithms?
- Every program or piece of software is built on two components: data and algorithms. Data is transformed into something software can use through algorithms. In order for algorithms to quickly retain, use, and iterate through data, it is crucial to understand how to arrange data.
- Data structures are the means by which we can store and retrieve information. You're already familiar with Python lists and dictionaries, so you understand that lists and arrays are sequential with data accessed by index, whereas dictionaries and objects store and retrieve information using a named key.
- Data Structures in programming languages resemble pretty much our real world if we think outside of the digital space.
- Think of a shopping complex where we see the all different types of clothes arranged in groups order if they weren't arranged in order then we'd find trouble finding the best kind of cloth we desire.
- Data structures handle four main functions for us:
- Inputting information
- Processing information
- Maintaining information
- Retrieving information
- Inputting Information concerned with how the data is received and what kind of information the data has and is it going to add at the beginning, end, or somewhere middle of the existing data.
- Processing deals with how the data is manipulated like, adding, removing, or updating data.
- Maintaining is concerned with how data is organized.
- Retrieving means finding the data and returning stored data in the structure.
- Algorithms are simply set of instructions that the computer follows to perform desired tasks.
- There are many types of algorithms but important ones are:
- Sorting Algorithms
- Search Algorithms
- Divide and Conquer Algorithms
- Brute Force Algorithms
- Greedy Algorithms
- For example: if we have an array of numbers (integers) we could perform something with this array we need an algorithm like if we wanted to sort this array in increasing order we are going to need a sorting algorithm, the same follows for searching and other operations.