Category Archives: Java Programs
Find Employees with the same salary using Java 8 Streams
Spring Setter Dependency Injection Example
In this post, We will learn about Spring Setter Dependency Injection Example with a Demo Project. Spring Dependency Injection The dependency Injection is a fundamental aspect of the Spring framework through which the Spring framework container injects objects or instances into other objects or “dependencies”. In another word, We can say that dependency Injection promotes loose coupling… Read More »
How to remove loop in LinkedList in Java ?
In this post, we will learn How to remove loop in LinkedList in Java. This problem statement is the extension of the below problems: How to check whether a linked list has a loop/cycle in java ? Find start node of the loop in Singly LinkedList in java After removing loop from Above image shown output… Read More »
Depth-First Search or DFS for a Graph Data Structure
In post talks about Depth-First Search or DFS for a Graph Data Structure with example To solve problems on graphs, we need a mechanism for traveling the graph. graph traversal algorithms are usually called Graph Search Algorithms. like trees traversal algorithms( inorder, preorder, and level order traversals), Graph Search algorithms can be thought of As… Read More »
Breadth-First Search or BFS for a Graph Data Structure
In post talks about Breadth-First Search or BFS for a Graph Data Structure with example To solve problems on graphs, we need a mechanism for traveling the graph. graph traversal algorithms are usually called Graph Search Algorithms. like trees traversal algorithms( inorder, preorder, and level order traversals), Graph Search algorithms can be thought of As… Read More »
How to write the Counting Sort program in Java ?
In this post, we will learn How to write the Counting Sort program in Java. Counting sort is one of the O(n) sorting algorithm like Bucket Sort and Radix Sort. Since it runs in linear time O(n) so counting sort is faster than the comparison-based algorithms like Quick Sort and Merge Sort. Even though counting… Read More »
How to write a Bucket Sort program in Java ?
In this post, we will learn How to write a Bucket sort program in Java. Bucket sort has a time complexity of O(n) like Radix sort and Counting sort. It runs in linear time O(n) so Bucket sort is faster than the comparison-based algorithms like Quick Sort or Merge Sort. Similar to the Counting sort,… Read More »
How to write a Quick Sort program in Java ?
In this post, we will learn How to write a quicksort program in Java. Quicksort is usually considered the fastest in-memory sorting algorithm in most of the situations. Just like Merge sort, It is also a divide and conquer algorithm. which works on the idea to partition the large list into smaller lists around a… Read More »
How to write a Radix sort program in Java
In this post, we will learn How to write a Radix sort program in Java. Radix sort is in the group of Counting Sort and Bucket Sort which are O(n) sorting algorithms. How does Radix sort work? The radix sort usually works by doing the sorting in passes moving from least significant digit to the… Read More »