# Category Archives: Core Java

This Category contains all the posts related to Core Java

## 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 »

## What is Red-Black Tree?

In this post, we will talk about What is Red-Black Tree? Red-Black Tree is usually a self-balancing Binary Search Tree (BST), In red-black trees, each node is associated with an extra attribute:  the color, which is either red or black. To get logarithmic complexity we impose the following restrictions.  Root Property: The root is black External… Read More »

## How to write Merge sort program in Java ?

In this post, we will learn How to write a Merge sort program in Java? Merge sort is very much efficient than the simple sorting algorithms like the bubble sort, selection sort, and insertion sort. the only drawback is that it requires an additional array along with the input array that is sorted. How to… Read More »

## Classification of Sorting Algorithms

In this post, we will talk about different Classification of Sorting Algorithms. Classification of Sorting Algorithms: By Number of Comparisons In this method, Sorting algorithms are usually classified based on the number of comparisons. For comparison-based sorting algorithms best-case behavior is O(n log n) and worst-case behavior is O(n2). Comparison-based sorting algorithms evaluate the elements of… Read More »