Learn Data Structures and Algorithm| DSA Tutorial #1| What is Data Structure and Algorithm
What is DSA?
DSA stands For [Data Structure and Algorithms]. Data Structure- It is the way to arrange data in main memory for efficient usage. E.g.- Array, Link List, Stack, Queue etc. Algorithm- It is the sequence of steps to solve the given problem. There are Different terminologies which are used while we are learning DSA. Lets Understand It, One by One.
Other Terminologies:-
Database:- Database is a Collection of information in permanent storage for faster retrieval and updating. For eg:- Storing data in Hard Drive and Retrieving it when it is in use.
Data Warehousing- Management of Huge amount of legacy data for better analysis. It is not for the transaction of data, the main focus is on designing a structure for query and analysis of the data.
Big Data- Analysis of too large or incomplete data which cannot be dealt with traditional data processing application. Old Applications are now not capable of dealing with too large data, it too difficult to operate them.
Memory Layout Of C Programs
Memory(Ram) |
---|
Heap |
Stack |
Uninitialized Data |
Initialized Data |
Code Segment |
-----> When the program Starts, its code is copied to the main memory.
-----> Stack Holds the memory occupied by the functions.
-----> Heap Contains The data which is requested by the program as the dynamic memory.
------> Initialized and uninitialized data segments hold initialized and uninitialized global variables respectively.
What is Time Complexity?
Time complexity is the time taken to execute an algorithm grows with the size of input. Or in other words the Amount of time which is taken by the CPU to perform execution of data, based on their size.
Lets Understand it by an Example:-
This morning i wanted to eat some pizzas, so i asked my brother to get me some pizzas form dominos which is (3km Far Away). He got me the pizza and i was happy only to realize it was too less for my 15 friends who came to my house for a surprise visit!. My Brother can get only 2 pizzas for me on his bike but pizza for my 15 friends is too huge of an input for him which he cannot handle.
2 🍕-----> 😄Okay! No big Deal.
15 🍕-------> 😥Not possible in short time.
Another Example
Consider two developer who created an Algorithm to short n numbers. Shubham and Rohan did this independently. We ran for input size n, following results were recorded.
No of Elements | Shubham's Algorithm | Rohan's Algorithm |
---|---|---|
10 Elements | 90 m/s | 112 m/s |
70 Elements | 110 m/s | 124 m/s |
110 Elements | 180 m/s | 131 m/s |
1000 Elements | 25 m/s | 800 m/ |
We can see that initially Shubham's Algorithm was working good for smaller input but as the number of elements increased Rohan's Algorithm look more efficient.
Now we understand what is DSA and What is Time Complexity. There are 100 of example by you can understand it. Now you can get started with your DSA and understand more concepts. DSA is Very crucial for JOBS and the market is becoming too tuff to get a job. So you have to master your field and should be able to solve different DSA Questions .