Insertion Sort in Java

In this tutorial you will learn about insertion sort in Java with example and program. Insertion Sort Principle The strategy behind this sorting is much similar to playing cards. In cards playing we used to see that player will hold the cards in sorted manner. Whenever he wants to insert a new card he will put that in such way that again the cards in hand should be in sorted manner only. The below image can illustrate the phenomenon. When

Read more

Selection Sort in Java

In this tutorial you will learn about selection sort in Java with example. It will sort the input elements in ascending or descending order by taking small or large element among the input elements and swap that element with the element in 1st position. Then it picks second small or large element and swap it with the element in second position. Likewise it will sort all the elements in the input in n-1 passes if our input size is n.

Read more

Breadth First Search (BFS) Java Program

Here you will get Breadth First Search (BFS) Java program along with example. Breadth First Search is graph traversal algorithm which has many applications in most of the algorithms. We will start with one node and we will explore all the nodes (neighbor nodes) in the same level. Then we should go to next level to explore all nodes in that level. Here BFS should fallow the graph traversal rule that it should visit each node exactly once. Also Read: Depth

Read more

Depth First Search (DFS) Java Program

In this tutorial you will learn about implementation of Depth First Search in Java with example. To traverse in trees we have traversal algorithms like inorder, preorder, postorder. Same way to traverse in graphs we have mainly two types of algorithms called DFS (Depth First Search) and BFS (Breadth First Search). In Depth First Search traversal we try to go away from starting vertex into the graph as deep as possible. We may face the case that our search never

Read more

Spring Dependency Injection (DI)

In this tutorial you will learn about Spring Dependency Injection (DI) concept with example. Dependency Injection is a design pattern that allows us to remove dependencies from code so that its easier to maintain and test the code. Lets try to understand why we really need dependency injection. Consider two classes Circle and DrawShape as given below.

In this example DrawShape class is dependent on Circle class because we have used new keyword to create Circle object. In case

Read more

Java LinkedList Class

In this tutorial you will learn about Java LinkedList class. Linked list is a linear data structure that contains nodes. Node stores data and reference to the next node. Java provides us in built classes and methods for creating and handling of linked list. So using linked list in java so easy. Also Read: Java Singly Linked List Implementation Java LinkedList Class Hierarchy of this class is: Java.lang.object java.util.AbstarctCollection java.util.AbstractList java.util.AbstarctSequentialList java.util.LinkedList Now we see those built-in methods of this class.

Read more

10 Reasons Why Java is Secure Language

In this article you will learn about why java is secure language than any other programming languages. It is a common question asked in java interviews. We know that java is really popular and widely used language. Security is the prime factor for java popularity. Lets discuss about the reasons why it is so secure. Image Source Why Java is Secure Language? Own Memory Management Java has its own memory management mechanism. It has automatic garbage collection system. User need

Read more
1 2 3 14