Daemon thread in java: Daemon thread is a low priority thread providing services to the user thread. This thread runs in the background to perform tasks such as garbage collection. Major Properties: It cannot prevent the JVM from exiting when all the user threads finish their execution. JVM terminates itself […]
Stacks In Java
Stack is a linear data structure ( an abstract data type ) with a fixed capacity. Linear data structure which is simple to use and allows adding and removing elements in a particular order i.e. a last-in-first-out (LIFO) order. Every element enters the stack from the top and leaves from the […]
Polymorphism in Java
The word polymorphism means having many forms. This feature of object-oriented programming allows us to perform a single action in different ways. In other words, polymorphism allows you to define one interface and have many implementations. The word “poly” means many and “morphs” means forms, which means multiple forms. In Java, […]
Insertion in a Doubly Linked List
Singly Linked List is the list that holds the links to the next node and so on, each node points to the next node, but the main drawback is it does not point to the last node in the list, Such a linked representation is called Doubly Linked List Representation […]
Program To Implement Queue in Java
A Queue is a linear data structure, following a particular order FIFO (First In First Out) where we can insert elements at one end and remove elements in the other end just like a human queue from the supermarket or railways ticket booking counters. In the previous article, we saw […]
Garbage Collection in Java
Garbage Collection in Java Garbage Collection means and as the name implies freeing up of space by the waste objects or garbage to avoid memory leaks. Since objects are dynamically allocated by using the new keyword how these objects are destroyed and their memory is released for reallocation. Some languages […]
Queues Interface in Java
Queue Interface: The Queue Interface in Java Collections provide functionality as a Queue in the real-life, it extends the collections interface. It represents real-world queues where people queue in waiting line in front of the Supermarket where new people add up at the end of the line (queue) and the […]
LinkedList in Java
Similar to Arrays in java Linked List is also a Linear data structure. In Linked List unlike arrays elements are not stored in a contiguous locations and they are linked to each other using references(pointers in memory), in Linked List each element has a reference pointing it to the next […]
Maximum Subarray Problem ( Kadane’s Algorithm) Dynamic Programming
Maximum SubArray Sum is the problem of finding the sum of contiguous subarray elements with in an array of numbers form arr[1…n] You might ask what is a subarray? SubArray is basically array within an array is called a sub array, as shown below 4, -1, 2 is the subarray […]
Two Pointer technique in Java
What is Two pointer technique? A two pointer technique is a technique where given a sorted array we have two starting points or two points of consideration as they both move towards the middle of the array being iterated over, the two pointer technique is a useful tool to utilize […]