Introduction to Data Structures
- The data structure is a method of collecting and organizing data in such a way that we can effectively conduct operations on it. Data Structures are used to organize and store data by presenting data items in terms of some relationship. For example, we have a data player named "Virat" who is 26 years old. The data types "Virat" and "26" are both String data types.
- This information can be organized into a record, similar to a Player record. As a data structure, we can now gather and store player records in a file or database.
- Data Structures, in simple terms, are structures that are programmed to contain ordered data so that various operations may be performed on it quickly.
Basic types of Data Structures
As we discussed above, anything that can store data can be called as a data strucure, hence Integer, Float, Boolean, Char etc, all are data structures. They are known as Primitive Data Structures.
Then we also have some complex Data Structures, which are used to store large and connected data. Some examples of Abstract Data Structure are :
- Linked List
- Tree
- Graph
- Stack, Queue, etc.
All these data structures allow us to perform different operations on data. We select these data structures based on which type of operation is required. We will look into these data structures in more detail in our later lessons.
Basics of Data Structure |
What is an Algorithm?
An algorithm is a finite set of instructions or logic that must be written in a specific order to complete a predetermined goal. The algorithm is not the entire code or program; rather, it is the basic logic (solution) of a problem, which can be stated in a flowchart or as a high-level description in pseudocode.
If an algorithm takes less time to perform and requires less memory space, it is said to be efficient and fast. The following properties are used to evaluate an algorithm's performance:
- Time Complexity
- Space Complexity
Space Complexity
It is the amount of memory space used by the algorithm while it is being executed. For multi-user systems and circumstances with limited memory, space complexity must be regarded seriously.
An algorithm generally requires space for the following components :
- Instruction Space: It's the space required to store the executable version of the program. This space is fixed but varies depending upon the number of lines of code in the program.
- Data Space: It's the space required to store all the constants and variables values.
- Environment Space: It's the space required to store the environment information needed to resume the suspended function.
Time Complexity
The term "time complexity" refers to the amount of time it takes for a program to complete. In our section, we'll go through this in-depth.
NOTE: Before going deep into a data structure, you should have a good knowledge of programming either in C or in C++ or Java.