# Category Archives: Java Programs

## Java Program for Cycle Sort

Cycle sort is an in-place sorting Algorithm, unstable sorting algorithm, a comparison sort that is theoretically optimal in terms of the total number of writes… Read More »

## Java Program for nth multiple of a number in Fibonacci Series

Given two integers n and k. Find position the n’th multiple of K in the Fibonacci series. Examples: Input : k = 2, n =… Read More »

## Java Program for Maximum height when coins are arranged in a triangle

We have N coins which need to arrange in form of a triangle, i.e. first row will have 1 coin, second row will have 2… Read More »

## Java Program for Common Divisors of Two Numbers

Given two integer numbers, the task is to find the count of all common divisors of given numbers? Input : a = 12, b =… Read More »

## Java Program for Linear Search

Problem: Given an array arr[] of n elements, write a function to search a given element x in arr[]. Java filter_none edit close play_arrow link… Read More »

## Java Program for Number of elements with odd factors in given range

Given a range [n, m], find the number of elements that have odd number of factors in the given range (n and m inclusive). Examples:… Read More »

## Java Program to check Armstrong Number

Given a number x, determine whether the given number is Armstrong number or not. A positive integer of n digits is called an Armstrong number… Read More »

## Java Program for BogoSort or Permutation Sort

BogoSort also known as permutation sort, stupid sort, slow sort, shotgun sort or monkey sort is a particularly ineffective algorithm based on generate and test… Read More »

## Java Program for Odd-Even Sort / Brick Sort

This is basically a variation of bubble-sort. This algorithm is divided into two phases- Odd and Even Phase. The algorithm runs until the array elements… Read More »

## Java Program for Gnome Sort

Algorithm Steps If you are at the start of the array then go to the right element (from arr[0] to arr[1]). If the current array… Read More »

## Java Program for Cocktail Sort

Cocktail Sort is a variation of Bubble sort. The Bubble sort algorithm always traverses elements from left and moves the largest element to its correct… Read More »

## Java Program for Bitonic Sort

Bitonic Sequence A sequence is called Bitonic if it is first increasing, then decreasing. In other words, an array arr[0..n-i] is Bitonic if there exists… Read More »

## Java Program for Bitonic Sort

Bitonic Sequence A sequence is called Bitonic if it is first increasing, then decreasing. In other words, an array arr[0..n-i] is Bitonic if there exists… Read More »

## Java Program to Check if count of divisors is even or odd

Given a number “n”, find its total number of divisors is even or odd. Examples: Input: n = 10 Output: Even Input: n = 100… Read More »

## Java Program for Pigeonhole Sort

Pigeonhole sorting is a sorting algorithm that is suitable for sorting lists of elements where the number of elements and the number of possible key… Read More »