Tuesday 24 October 2017

Java Code for Matrix Multiplication

Problem:

Java Code for Matrix Multiplication

Solution:

package com.basics;

import java.util.Scanner;

public class MatrixMultiplication {

static int[][] array1;
static int[][] array2;
static int[][] array3;
int rowLimit;
int columnLimit;


public static void main(String[] args) {
MatrixMultiplication matrixMultiplication = new MatrixMultiplication();
matrixMultiplication.initializeTheArrays();
System.out.println("the first matrix elements are: ");
matrixMultiplication.printMatrix(array1);
System.out.println("the second matrix elements are: ");
matrixMultiplication.printMatrix(array2);
matrixMultiplication.doMatrixMultiplication();
System.out.println("the resulted matrix elements are: ");
matrixMultiplication.printMatrix(array3);
}

public void initializeTheArrays(){
Scanner scanner = new Scanner(System.in);
System.out.println("enter the array row limit");
rowLimit = scanner.nextInt();
System.out.println("enter the array column limit");
columnLimit = scanner.nextInt();
array1 = new int[rowLimit][columnLimit];
System.out.println("enter the array1 elements");
for (int i = 0; i < rowLimit; i++) {
for (int j = 0; j < columnLimit; j++) {
System.out.println("enter the element");
array1[i][j] = scanner.nextInt();
}

}

array2 = new int[rowLimit][columnLimit];
System.out.println("enter the array2 elements");
for (int i = 0; i < rowLimit; i++) {
for (int j = 0; j < columnLimit; j++) {
System.out.println("enter the element");
array2[i][j] = scanner.nextInt();
}
}

array3 = new int[rowLimit][columnLimit];
scanner.close();
}

public void doMatrixMultiplication(){
for (int i = 0; i < rowLimit; i++) {
for (int j = 0; j < columnLimit; j++) {
for (int k = 0; k < rowLimit; k++)
                {
                    array3[i][j] = array3[i][j] + array1[i][k] * array2[k][j];
                }
}
}
}

public void printMatrix(int[][] array){
for (int i = 0; i < rowLimit; i++) {
for (int j = 0; j < columnLimit; j++) {
System.out.print(array[i][j] + " ");
}
System.out.println();
}
}

}


Output:

enter the array row limit
2
enter the array column limit
2
enter the array1 elements
enter the element
1
enter the element
2
enter the element
3
enter the element
4
enter the array2 elements
enter the element
4
enter the element
3
enter the element
2
enter the element
1
the first matrix elements are:
1 2
3 4
the second matrix elements are:
4 3
2 1
the resulted matrix elements are:
8 5
20 13


enter the array row limit
3
enter the array column limit
3
enter the array1 elements
enter the element
1
enter the element
2
enter the element
3
enter the element
4
enter the element
5
enter the element
6
enter the element
7
enter the element
8
enter the element
9
enter the array2 elements
enter the element
2
enter the element
3
enter the element
4
enter the element
5
enter the element
6
enter the element
7
enter the element
8
enter the element
9
enter the element
1
the first matrix elements are: 
1 2 3 
4 5 6 
7 8 9 
the second matrix elements are: 
2 3 4 
5 6 7 
8 9 1 
the resulted matrix elements are: 
36 42 21 
81 96 57 
126 150 93 


Sunday 15 October 2017

Java Code to find the Maximum sum of Sub Array using Brute-force method

Problem:

Write a java program for the brute-force method of solving the maximum-subarray
problem.

Solution:

package com.basics;

import java.util.Scanner;

public class MaxSumOfSubArray {

static int[] array;
int arrayLimit;


public static void main(String[] args) {
MaxSumOfSubArray maxSumOfSubArray = new MaxSumOfSubArray();
maxSumOfSubArray.initializeTheArrays();
maxSumOfSubArray.findMaximumSumOfSubArray();
}

public void initializeTheArrays(){
Scanner scanner = new Scanner(System.in);
System.out.println("enter the array limit");
arrayLimit = scanner.nextInt();
array = new int[arrayLimit];
System.out.println("enter the array elements");
for (int i = 0; i < array.length; i++) {
System.out.println("enter the element");
array[i] = scanner.nextInt();
}
scanner.close();
}

public void findMaximumSumOfSubArray(){
int answer = Integer.MIN_VALUE;
for(int sub_array_size = 1; sub_array_size <= arrayLimit; ++sub_array_size ){
for (int startIndex = 0; startIndex < array.length; ++startIndex) {
if(startIndex + sub_array_size > arrayLimit){
break;
}
int sum = 0;
for(int i = startIndex; i < (startIndex + sub_array_size); i++){
sum = sum + array[i];
}
answer = Math.max(answer, sum);

}
}

System.out.println("the max sub array sum is "+ answer);
}



}

Output:

enter the array limit
8
enter the array elements
enter the element
-2
enter the element
-3
enter the element
4
enter the element
-1
enter the element
-2
enter the element
1
enter the element
5
enter the element
-3
the max sub array sum is 7

Saturday 14 October 2017

Java Code to find the inversions of the array

Problem:

Let A[1...n] be an array of n distinct numbers. If i < j and A[i] > A[j ], then the
pair (i,j)  is called an inversion of A.

List the inversions for the given array.


Solution:

package com.basics;

import java.util.Scanner;

public class InversionsOfAnArray {

static int[] array;
int arrayLimit;

public static void main(String[] args) {
InversionsOfAnArray inversionsOfAnArray = new InversionsOfAnArray();
inversionsOfAnArray.initializeTheArrays();
inversionsOfAnArray.findInversions();
}

public void initializeTheArrays(){
Scanner scanner = new Scanner(System.in);
System.out.println("enter the array limit");
arrayLimit = scanner.nextInt();
array = new int[arrayLimit];
System.out.println("enter the array elements");
for (int i = 0; i < array.length; i++) {
System.out.println("enter the element");
array[i] = scanner.nextInt();
}
scanner.close();
}

public void findInversions(){
for (int i = 0; i < array.length - 1; i++) {
for (int j = i + 1; j < array.length; j++) {
if(array[i] > array[j]){
System.out.println("The inversion Pair is: " + array[i] + " ," + array[j]);
}
}
}
}

}


Output:

enter the array limit
5
enter the array elements
enter the element
2
enter the element
3
enter the element
8
enter the element
6
enter the element
1
The inversion Pair is: 2 ,1
The inversion Pair is: 3 ,1
The inversion Pair is: 8 ,6
The inversion Pair is: 8 ,1
The inversion Pair is: 6 ,1


Java Code determines whether or not there exist two elements in S whose sum is exactly x

Problem:

For a given a set S of n integers and another integer x, determines whether or not there exist two elements in S whose sum is exactly x.

Solution:

package com.basics;

import java.util.Scanner;

public class FindExactSum {

static int[] array;
int arrayLimit;
int x;

public static void main(String[] args) {
FindExactSum findExactSum = new FindExactSum();
findExactSum.initializeTheArrays();
System.out.println("is the array contains two elements whose sum is exactly equal to given x?? " + findExactSum.isExactSumAvaiableInTheArray());
}

public void initializeTheArrays(){
Scanner scanner = new Scanner(System.in);
System.out.println("enter the array limit");
arrayLimit = scanner.nextInt();
array = new int[arrayLimit];
System.out.println("enter the array elements");
for (int i = 0; i < array.length; i++) {
System.out.println("enter the element");
array[i] = scanner.nextInt();
}

System.out.println("enter the x value");
x = scanner.nextInt();
scanner.close();
}

public boolean isExactSumAvaiableInTheArray(){
boolean flag = false;
for (int i = 0; i < array.length; i++) {
for (int j = i; j < array.length; j++) {
if(array[i] + array[j] == x){
flag = true;
break;
}
}
}
return flag;
}

}


Output:

enter the array limit
3
enter the array elements
enter the element
12
enter the element
12
enter the element
3
enter the x value
14
is the array contains two elements whose sum is exactly equal to given x?? false


enter the array limit
4
enter the array elements
enter the element
12
enter the element
33
enter the element
2
enter the element
33
enter the x value
35
is the array contains two elements whose sum is exactly equal to given x?? true

Java Code for insertion sort using recursion

Problem:

We can express insertion sort as a recursive procedure as follows. In order to sort
A[1.. n], we recursively sort A[1.. n-1] and then insert A[n] into the sorted array
A[1.. n- 1]. Write a recurrence for the running time of this recursive version of
insertion sort.

Solution:

package com.basics;

import java.util.Arrays;
import java.util.Scanner;

public class InsertionSortUsingRecursion {

static int[] array;
int arrayLimit;

public static void main(String[] args) {
InsertionSortUsingRecursion insertionSort = new InsertionSortUsingRecursion();
insertionSort.initializeTheArrays();
System.out.println("Before sorting an array is " + Arrays.toString(array));
insertionSort.insertionSort(array, array.length);
System.out.println("After sorting an array is " + Arrays.toString(array));

}

public void initializeTheArrays(){
Scanner scanner = new Scanner(System.in);
System.out.println("enter the array limit");
arrayLimit = scanner.nextInt();
array = new int[arrayLimit];
System.out.println("enter the array elements");
for (int i = 0; i < array.length; i++) {
System.out.println("enter the element");
array[i] = scanner.nextInt();
}
scanner.close();
}

public void insertionSort(int[] arr, int n){
        if (n <= 1)
            return;
     
        insertionSort( arr, n-1 );
     
        int last = arr[n-1];
        int j = n-2;
     
        while (j >= 0 && arr[j] > last)
        {
            arr[j+1] = arr[j];
            j--;
        }
        arr[j+1] = last;
}
}


Output:

enter the array limit
5
enter the array elements
enter the element
12
enter the element
3
enter the element
44
enter the element
1
enter the element
2344
Before sorting an array is [12, 3, 44, 1, 2344]
After sorting an array is [1, 3, 12, 44, 2344]


Friday 13 October 2017

Java Code for Merge sort using Divide and Conquer method

Problem:

Java Code for Merge sort using Divide and Conquer method

Solution:

package com.basics;

import java.util.Arrays;
import java.util.Scanner;

public class MergeSort {

static int[] array;
int arrayLimit;

public static void main(String[] args) {
MergeSort mergeSort = new MergeSort();
mergeSort.initializeTheArrays();
System.out.println("Before sorting an array is " + Arrays.toString(array));
mergeSort.doMergeSort(array, 0, array.length - 1);
System.out.println("After sorting an array is " + Arrays.toString(array));

}

public void initializeTheArrays(){
Scanner scanner = new Scanner(System.in);
System.out.println("enter the array limit");
arrayLimit = scanner.nextInt();
array = new int[arrayLimit];
System.out.println("enter the array elements");
for (int i = 0; i < array.length; i++) {
System.out.println("enter the element");
array[i] = scanner.nextInt();
}
scanner.close();
}

public void doMergeSort(int[] a, int l, int r){
int m;
if(l < r){
m = (l + r) / 2;
doMergeSort(a, l, m);
doMergeSort(a, m + 1, r);
merge(a, l, m, r);
}
}

public void merge(int[] a, int l, int m, int r){
int n1 = m - l + 1;
int n2 = r - m;

int[] leftArray = new int[n1];
int[] rightArray = new int[n2];

for (int i = 0; i < leftArray.length; ++i) {
leftArray[i] = a[l+i];
}

for (int i = 0; i < rightArray.length; ++i) {
rightArray[i] = a[m+1+i];
}

int i = 0;
int j = 0;
int k = l;
        while (i < n1 && j < n2)
        {
            if (leftArray[i] <= rightArray[j])
            {
                a[k] = leftArray[i];
                i++;
            }
            else
            {
                a[k] = rightArray[j];
                j++;
            }
            k++;
        }

while (i < n1)
        {
            a[k] = leftArray[i];
            i++;
            k++;
        }

        while (j < n2)
        {
            a[k] = rightArray[j];
            j++;
            k++;
        }

}

}


Output:

enter the array limit
7
enter the array elements
enter the element
123
enter the element
3
enter the element
456
enter the element
7
enter the element
89
enter the element
90
enter the element
34
Before sorting an array is [123, 3, 456, 7, 89, 90, 34]
After sorting an array is [3, 7, 34, 89, 90, 123, 456]


Java Code for Selection Sort

Problem:

Consider sorting n numbers stored in array A by first finding the smallest element
of A and exchanging it with the element in A[1]. Then find the second smallest
element of A, and exchange it with A[2]. Continue in this manner for the first n-1
elements of A. Write pseudocode for this algorithm, which is known as selection
sort.

Solution:

package com.basics;

import java.util.Arrays;
import java.util.Scanner;

public class SelectionSort {

static int[] array;
int arrayLimit;

public static void main(String[] args) {
SelectionSort selectionSort = new SelectionSort();
selectionSort.initializeTheArrays();
System.out.println("Before sorting an array is " + Arrays.toString(array));
selectionSort.doSelectionSort();
System.out.println("After sorting an array is " + Arrays.toString(array));

}

public void initializeTheArrays(){
Scanner scanner = new Scanner(System.in);
System.out.println("enter the array limit");
arrayLimit = scanner.nextInt();
array = new int[arrayLimit];
System.out.println("enter the array elements");
for (int i = 0; i < array.length; i++) {
System.out.println("enter the element");
array[i] = scanner.nextInt();
}
scanner.close();
}

public void doSelectionSort(){
int index ;
for (int i = 0; i < array.length - 1; i++) {
index = i;
for (int j = i + 1; j < array.length; j++) {
if(array[j] < array[index]){
index = j;
}
}

int min = array[index];
array[index] = array[i];
array[i] = min;

}
}

}

Output:

enter the array limit
5
enter the array elements
enter the element
12
enter the element
3
enter the element
44
enter the element
333
enter the element
2
Before sorting an array is [12, 3, 44, 333, 2]
After sorting an array is [2, 3, 12, 44, 333]

Monday 9 October 2017

Addition of two n-bit binary integers

Problem:

Consider the problem of adding two n-bit binary integers, stored in two n-element
arrays A and B. The sum of the two integers should be stored in binary form in an .n + 1 -element array C. State the problem formally and write pseudocode for
adding the two integers

Solution:

package com.basics;


public class BitArrayAddition {

public static void main(String[] args) {
int[] array1 = {0,1,0,1,1};
int[] array2 = {0,0,0,1,1};
int[] array3 = new int[5];

int carry = 0;
for (int i = array3.length - 1; i > 0; i--) {
array3[i] = (array1[i] + array2[i] + carry) % 2;
carry = (array1[i] + array2[i] + carry) / 2;
}
array3[0] = carry;
for (int i = 0; i < array3.length; i++) {
System.out.print(array3[i] + " ");
}

}

}


Output:

0 1 1 1 0

Thursday 5 October 2017

Java Program for Binary number addition

Problem:

Java Program for Binary number addition


Solution:
package com.basics;

import java.util.Scanner;

public class BinaryAddition {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
      int arr[] = new int[10];
      int i,m,n,sum,carry=0;
      System.out.println ("enter 1st binary number");
      int n1 = sc.nextInt();
      System.out.println ("enter 2nd binary number");
      int n2 = sc.nextInt();
      for(i=arr.length-1;i>=0;i--){
          m=n1%10;
          n=n2%10;
          n1=n1/10;
          n2=n2/10;
          sum=m+n+carry;
          if(sum==1)
          {
            arr[i]=1;
            carry = 0;
          }
         
          else if(sum==2)
          {
              arr[i]=0;
              carry=1;
          }
          else if(sum==3)
          {
              arr[i]=1;
              carry=1;
          }
          else{
              arr[i]=m+n+carry;
          }
      }
      for(i=0;i<arr.length;i++){
          System.out.print(arr[i]);
      }
      }


}


Output:

enter 1st binary number
10
enter 2nd binary number
11
0000000101


Wednesday 4 October 2017

Java Code to sort an array into nonincreasing order using Insertion Sort

Problem:

Java Code to sort an array into nonincreasing order using Insertion Sort

Solution:

package com.basics;

import java.util.Arrays;

public class InsertionSort {

public static void main(String[] args) {
int[] array = {31, 41, 59, 26, 41, 58};
doInsertionSort(array);
System.out.println(Arrays.toString(array));
}

public static void doInsertionSort(int[] a){
int key = 0;
int j = 0;
for (int i = 1; i < a.length; i++) {
key = a[i];
j = i-1;
int tmp = 0;
while(j > -1 && a[j] < key){
tmp = a[j];
a[j] = a[j + 1];
a[j + 1] = tmp;
j = j-1;
}


}
}

}


Output:

[59, 58, 41, 41, 31, 26]

Java Code for Insertion Sort

Problem:

Sort the given array using Insertion Sort

Solution:

package com.basics;

import java.util.Arrays;

public class InsertionSort {

public static void main(String[] args) {
int[] array = {31, 41, 59, 26, 41, 58};
doInsertionSort(array);
System.out.println(Arrays.toString(array));
}

public static void doInsertionSort(int[] a){
int key = 0;
int j = 0;
for (int i = 1; i < a.length; i++) {
key = a[i];
j = i-1;
while(j > -1 && a[j] > key){
a[j+1] = a[j];
j = j-1;
}
a[j + 1] = key;

}
}

}


Output:

[26, 31, 41, 41, 58, 59]


Sunday 1 October 2017

Java program that takes all the lines input to standard input and writes them to standard output in reverse order. That is, each line is output in the correct order, but the ordering of the lines is reversed.

Problem:

Write a short Java program that takes all the lines input to standard input and
writes them to standard output in reverse order. That is, each line is output in the
correct order, but the ordering of the lines is reversed.

Solution:

package com.basics;

import java.util.Scanner;

public class LineReversal {


public static void main(String[] args) {
Scanner  scanner    = new Scanner(System.in);

    System.out.printf("Please specify how many lines you want to enter: ");       
    String[] input = new String[scanner.nextInt()];
    scanner.nextLine(); //consuming the <enter> from input above

    for (int i = 0; i < input.length; i++) {
        input[i] = scanner.nextLine();
    }

    System.out.printf("\nYour input:\n");
    for (String s : input) {
        System.out.println(s);
    }

    System.out.printf("\nReverse Order:\n");
    for (int i = input.length - 1; i >= 0 ; i--) {
    System.out.println(input[i]);
}
}

}


Output:

Please specify how many lines you want to enter: 3
Write a short Java program that takes all the lines input to standard input and
writes them to standard output in reverse order. That is, each line is output in the
correct order, but the ordering of the lines is reversed.

Your input:
Write a short Java program that takes all the lines input to standard input and
writes them to standard output in reverse order. That is, each line is output in the
correct order, but the ordering of the lines is reversed.

Reverse Order:
correct order, but the ordering of the lines is reversed.
writes them to standard output in reverse order. That is, each line is output in the
Write a short Java program that takes all the lines input to standard input and

Java program that takes two arrays a and b of length n storing int values, and returns the dot product of a and b. That is, it returns an array c of length n such that c[i] = a[i] · b[i], for i = 0, . . . ,n−1.

Problem:

Write a short Java program that takes two arrays a and b of length n storing int
values, and returns the dot product of a and b. That is, it returns an array c of
length n such that c[i] = a[i] · b[i], for i = 0, . . . ,n−1.

Solution:

package com.basics;

import java.util.Arrays;
import java.util.Scanner;

public class ArrayProduct {

static int[] arrayOne;
static int[] arrayTwo;
static int[] resultArray;
int arrayLimit;

public static void main(String[] args) {
ArrayProduct arrayProduct = new ArrayProduct();
arrayProduct.initializeTheArrays();
arrayProduct.findArrayProduct();
System.out.println("The first Array elements are " + Arrays.toString(arrayOne));
System.out.println("The second Array elements are " + Arrays.toString(arrayTwo));
System.out.println("The product result Array elements are " + Arrays.toString(resultArray));
}

public void initializeTheArrays(){
Scanner scanner = new Scanner(System.in);
System.out.println("enter the array limit");
arrayLimit = scanner.nextInt();
arrayOne = new int[arrayLimit];
arrayTwo = new int[arrayLimit];
resultArray = new int[arrayLimit];
System.out.println("enter the first array elements");
for (int i = 0; i < arrayOne.length; i++) {
System.out.println("enter the element");
arrayOne[i] = scanner.nextInt();
}
System.out.println("enter the second array elements");
for (int i = 0; i < arrayTwo.length; i++) {
System.out.println("enter the element");
arrayTwo[i] = scanner.nextInt();
}
scanner.close();
}

public void findArrayProduct(){
for (int i = 0; i < arrayOne.length; i++) {
resultArray[i] = arrayOne[i] * arrayTwo[i];
}
}
}


Output:

enter the array limit
3
enter the first array elements
enter the element
2
enter the element
3
enter the element
4
enter the second array elements
enter the element
5
enter the element
6
enter the element
7
The first Array elements are [2, 3, 4]
The second Array elements are [5, 6, 7]
The product result Array elements are [10, 18, 28]


Java program that outputs all possible strings formed by using the characters 'c', 'a', 't', 'd', 'o', and 'g' exactly once.

Problem:

Write a short Java program that outputs all possible strings formed by using the
characters 'c', 'a', 't', 'd', 'o', and 'g' exactly once.

Solution:

package com.basics;

public class PossibleStrings {

static char[] characters = {'c','a','t','d','o','g'};

public static void main(String[] args) {
    printPermutation(characters, 0, characters.length);
}

private static void printPermutation(char[] a, int startIndex, int endIndex) {
    if (startIndex == endIndex)//reached end of recursion, print the state of a
        System.out.println(new String(a));
    else {
        //try to move the swap window from start index to end index
        //i.e 0 to a.length-1
        for (int x = startIndex; x < endIndex; x++) {
            swap(a, startIndex, x);
            printPermutation(a, startIndex + 1, endIndex);
            swap(a, startIndex, x);
        }
    }
}

private static void swap(char[] a, int i, int x) {
    char t = a[i];
    a[i] = a[x];
    a[x] = t;
}

}


Output:

catdog
catdgo
catodg
catogd
catgod
catgdo
cadtog
cadtgo
cadotg
cadogt
cadgot
cadgto
caodtg
caodgt
caotdg
caotgd
caogtd
caogdt
cagdot
cagdto
cagodt
cagotd
cagtod
cagtdo
ctadog
ctadgo
ctaodg
ctaogd
ctagod
ctagdo
ctdaog
ctdago
ctdoag
ctdoga
ctdgoa
ctdgao
ctodag
ctodga
ctoadg
ctoagd
ctogad
ctogda
ctgdoa
ctgdao
ctgoda
ctgoad
ctgaod
ctgado
cdtaog
cdtago
cdtoag
cdtoga
cdtgoa
cdtgao
cdatog
cdatgo
cdaotg
cdaogt
cdagot
cdagto
cdoatg
cdoagt
cdotag
cdotga
cdogta
cdogat
cdgaot
cdgato
cdgoat
cdgota
cdgtoa
cdgtao
cotdag
cotdga
cotadg
cotagd
cotgad
cotgda
codtag
codtga
codatg
codagt
codgat
codgta
coadtg
coadgt
coatdg
coatgd
coagtd
coagdt
cogdat
cogdta
cogadt
cogatd
cogtad
cogtda
cgtdoa
cgtdao
cgtoda
cgtoad
cgtaod
cgtado
cgdtoa
cgdtao
cgdota
cgdoat
cgdaot
cgdato
cgodta
cgodat
cgotda
cgotad
cgoatd
cgoadt
cgadot
cgadto
cgaodt
cgaotd
cgatod
cgatdo
actdog
actdgo
actodg
actogd
actgod
actgdo
acdtog
acdtgo
acdotg
acdogt
acdgot
acdgto
acodtg
acodgt
acotdg
acotgd
acogtd
acogdt
acgdot
acgdto
acgodt
acgotd
acgtod
acgtdo
atcdog
atcdgo
atcodg
atcogd
atcgod
atcgdo
atdcog
atdcgo
atdocg
atdogc
atdgoc
atdgco
atodcg
atodgc
atocdg
atocgd
atogcd
atogdc
atgdoc
atgdco
atgodc
atgocd
atgcod
atgcdo
adtcog
adtcgo
adtocg
adtogc
adtgoc
adtgco
adctog
adctgo
adcotg
adcogt
adcgot
adcgto
adoctg
adocgt
adotcg
adotgc
adogtc
adogct
adgcot
adgcto
adgoct
adgotc
adgtoc
adgtco
aotdcg
aotdgc
aotcdg
aotcgd
aotgcd
aotgdc
aodtcg
aodtgc
aodctg
aodcgt
aodgct
aodgtc
aocdtg
aocdgt
aoctdg
aoctgd
aocgtd
aocgdt
aogdct
aogdtc
aogcdt
aogctd
aogtcd
aogtdc
agtdoc
agtdco
agtodc
agtocd
agtcod
agtcdo
agdtoc
agdtco
agdotc
agdoct
agdcot
agdcto
agodtc
agodct
agotdc
agotcd
agoctd
agocdt
agcdot
agcdto
agcodt
agcotd
agctod
agctdo
tacdog
tacdgo
tacodg
tacogd
tacgod
tacgdo
tadcog
tadcgo
tadocg
tadogc
tadgoc
tadgco
taodcg
taodgc
taocdg
taocgd
taogcd
taogdc
tagdoc
tagdco
tagodc
tagocd
tagcod
tagcdo
tcadog
tcadgo
tcaodg
tcaogd
tcagod
tcagdo
tcdaog
tcdago
tcdoag
tcdoga
tcdgoa
tcdgao
tcodag
tcodga
tcoadg
tcoagd
tcogad
tcogda
tcgdoa
tcgdao
tcgoda
tcgoad
tcgaod
tcgado
tdcaog
tdcago
tdcoag
tdcoga
tdcgoa
tdcgao
tdacog
tdacgo
tdaocg
tdaogc
tdagoc
tdagco
tdoacg
tdoagc
tdocag
tdocga
tdogca
tdogac
tdgaoc
tdgaco
tdgoac
tdgoca
tdgcoa
tdgcao
tocdag
tocdga
tocadg
tocagd
tocgad
tocgda
todcag
todcga
todacg
todagc
todgac
todgca
toadcg
toadgc
toacdg
toacgd
toagcd
toagdc
togdac
togdca
togadc
togacd
togcad
togcda
tgcdoa
tgcdao
tgcoda
tgcoad
tgcaod
tgcado
tgdcoa
tgdcao
tgdoca
tgdoac
tgdaoc
tgdaco
tgodca
tgodac
tgocda
tgocad
tgoacd
tgoadc
tgadoc
tgadco
tgaodc
tgaocd
tgacod
tgacdo
datcog
datcgo
datocg
datogc
datgoc
datgco
dactog
dactgo
dacotg
dacogt
dacgot
dacgto
daoctg
daocgt
daotcg
daotgc
daogtc
daogct
dagcot
dagcto
dagoct
dagotc
dagtoc
dagtco
dtacog
dtacgo
dtaocg
dtaogc
dtagoc
dtagco
dtcaog
dtcago
dtcoag
dtcoga
dtcgoa
dtcgao
dtocag
dtocga
dtoacg
dtoagc
dtogac
dtogca
dtgcoa
dtgcao
dtgoca
dtgoac
dtgaoc
dtgaco
dctaog
dctago
dctoag
dctoga
dctgoa
dctgao
dcatog
dcatgo
dcaotg
dcaogt
dcagot
dcagto
dcoatg
dcoagt
dcotag
dcotga
dcogta
dcogat
dcgaot
dcgato
dcgoat
dcgota
dcgtoa
dcgtao
dotcag
dotcga
dotacg
dotagc
dotgac
dotgca
doctag
doctga
docatg
docagt
docgat
docgta
doactg
doacgt
doatcg
doatgc
doagtc
doagct
dogcat
dogcta
dogact
dogatc
dogtac
dogtca
dgtcoa
dgtcao
dgtoca
dgtoac
dgtaoc
dgtaco
dgctoa
dgctao
dgcota
dgcoat
dgcaot
dgcato
dgocta
dgocat
dgotca
dgotac
dgoatc
dgoact
dgacot
dgacto
dgaoct
dgaotc
dgatoc
dgatco
oatdcg
oatdgc
oatcdg
oatcgd
oatgcd
oatgdc
oadtcg
oadtgc
oadctg
oadcgt
oadgct
oadgtc
oacdtg
oacdgt
oactdg
oactgd
oacgtd
oacgdt
oagdct
oagdtc
oagcdt
oagctd
oagtcd
oagtdc
otadcg
otadgc
otacdg
otacgd
otagcd
otagdc
otdacg
otdagc
otdcag
otdcga
otdgca
otdgac
otcdag
otcdga
otcadg
otcagd
otcgad
otcgda
otgdca
otgdac
otgcda
otgcad
otgacd
otgadc
odtacg
odtagc
odtcag
odtcga
odtgca
odtgac
odatcg
odatgc
odactg
odacgt
odagct
odagtc
odcatg
odcagt
odctag
odctga
odcgta
odcgat
odgact
odgatc
odgcat
odgcta
odgtca
odgtac
octdag
octdga
octadg
octagd
octgad
octgda
ocdtag
ocdtga
ocdatg
ocdagt
ocdgat
ocdgta
ocadtg
ocadgt
ocatdg
ocatgd
ocagtd
ocagdt
ocgdat
ocgdta
ocgadt
ocgatd
ocgtad
ocgtda
ogtdca
ogtdac
ogtcda
ogtcad
ogtacd
ogtadc
ogdtca
ogdtac
ogdcta
ogdcat
ogdact
ogdatc
ogcdta
ogcdat
ogctda
ogctad
ogcatd
ogcadt
ogadct
ogadtc
ogacdt
ogactd
ogatcd
ogatdc
gatdoc
gatdco
gatodc
gatocd
gatcod
gatcdo
gadtoc
gadtco
gadotc
gadoct
gadcot
gadcto
gaodtc
gaodct
gaotdc
gaotcd
gaoctd
gaocdt
gacdot
gacdto
gacodt
gacotd
gactod
gactdo
gtadoc
gtadco
gtaodc
gtaocd
gtacod
gtacdo
gtdaoc
gtdaco
gtdoac
gtdoca
gtdcoa
gtdcao
gtodac
gtodca
gtoadc
gtoacd
gtocad
gtocda
gtcdoa
gtcdao
gtcoda
gtcoad
gtcaod
gtcado
gdtaoc
gdtaco
gdtoac
gdtoca
gdtcoa
gdtcao
gdatoc
gdatco
gdaotc
gdaoct
gdacot
gdacto
gdoatc
gdoact
gdotac
gdotca
gdocta
gdocat
gdcaot
gdcato
gdcoat
gdcota
gdctoa
gdctao
gotdac
gotdca
gotadc
gotacd
gotcad
gotcda
godtac
godtca
godatc
godact
godcat
godcta
goadtc
goadct
goatdc
goatcd
goactd
goacdt
gocdat
gocdta
gocadt
gocatd
goctad
goctda
gctdoa
gctdao
gctoda
gctoad
gctaod
gctado
gcdtoa
gcdtao
gcdota
gcdoat
gcdaot
gcdato
gcodta
gcodat
gcotda
gcotad
gcoatd
gcoadt
gcadot
gcadto
gcaodt
gcaotd
gcatod
gcatdo

Program for primality test in JAVA

Problem: ============= Program for primality test in JAVA What is primality test? A primality test is an algorithm for determining wh...