Posts

LinkedList in DSA || Java and DSA course || Blog 16

Image
I n simple words, a collection which can contain many objects of the same type, like the ArrayList is a LinkedList. Arraylist uses dynamic array. Lets say we take an array size of 5. we gave input as 1,2,3,4,5. Now, if we gave it one more value, It creates a new arraylist of sizex2 = 5x2 = 10. it copies data from the first arraylist and then appends the new value. if something is removed between the arraylist, every value shifts one by one. Same is with the insert. From this, we can say that arraylist is better for storing values instead of manipulating it. So what is the difference between ArrayList and LinkedList? In this blog we will take a look into Singular LinkedList and code related to it. For a quick overview, contents are, What is LinkedList? Difference between arraylist and linkedlist Creating Node class Add Node at beginning Extend a node Delete first node Delete last node What is LinkedList? LinkedList is nothing but nodes connected to each other. A node is a point ...

OOPS in Java || Java and DSA course || Blog 15

Image
OOPS stands for object oriented programming system. OOPS is common in every programming language whether it is c++ or java . Modern languages are based on oops. for a quick overview , we will be learning ; constructors Polymorphism Inheritance Access Modifiers Encapsulation Abstraction what is an object and classes ? Everything in Java is associated with classes and objects, along with its attributes and methods. A Class is like an object constructor, or a "blueprint" for creating objects.  lets take a student. Here, a student is an object while attributes like name, age, section is object attributes/classes. the functions inside the classes are called members.     in the line Student student1 = new Student(); new stands for the memory allocation Student() is a special type of function called Constructors. Constructors constructors construct objects. They cannot return .Their name should be same in the class . It calls only one time. there are 3 types of constructors: N...