Today, I am excited to announce the start of a new blog series in which I will be sharing my journey through the world of Data Structures and Algorithms (DSA).
In this blog series, I will be sharing the topics that I have learned in my DSA journey one by one. I will provide a brief overview of each topic, explain how it works, and share any examples or exercises that I worked on to help me understand the concept better.
If you're interested in learning more about DSA, I highly recommend checking out this amazing playlist on YouTube called "Java + DSA + Interview Preparation Course" by Kunal Kushwaha .
Let's get started...
Programming is a way to instruct the computer to perform various task. Computers only understands Binary i.e., 0’s and 1’s.
Instructing computers in Binary i.e. 0’s and 1’s are very difficult for humans so, to solve this issue we have programming languages.
What is a Programming Language?
It is a computer language used by programmers to communicate with computers.
Types of Programming Language :
Procedural : Specifies a series of well-structured steps and procedures to compose a program.
Functional : Writing a program only in pure functions i.e., never modify variables but only create new ones as an output.
Object-Oriented : It revolves around the object. It is developed to make it easier to develop, debug, reuse and maintain software.
Static vs Dynamic languages :
Static | Dynamic |
Perform type checking at compile time | Perform type checking at runtime |
Errors will show at compile time | Error might not show till programs run |
Declare datatypes before use | No need to declare datatype of variables |
More control | Saves time in writing code but might give error at runtime. |
Memory Management :
There are 2 types of memory Stack and Heap
When we declare a variable then the reference variable stored in stack memory points to the object of that variable stored in heap memory.
Here “a” is called reference variable, and “10” is the object of that reference variable
Reference variable are stored in stack memory.
Heap memory stores the objects of reference variable.
Points to remember :
Different refrence variables can point to same object.
If any of these refrence variable change the object, original object is going to be changed and it's going to be changed for all.
Ex: If son gets a haircut, it will happen for all others. Even though the change is done by ine refrence variable, original objects are changed. And change will be visible to all other refrence variable.
If there is an object without reference variable then object will be destroyed by “Garbage Collection”
Garbage Collection :
If any object does not have a refrence variable like 10, it will be automatically deleted by Garbage Collector.