## Insertion Sort in Java Example

by Dinesh Thakur Category: array

Algorithm for Insertion Sort:

Here 'a' is an array of elements and 'n' represents the number of elements in the array 'a'

step 1: Initialize j= 1

step 2: repeat through step-8 while(j<n)

step 3: set item =a[j]

## Quick Sort in Java Example

by Dinesh Thakur Category: array

Algorithm for Quick Sort:

Here 'a' is an array of elements and 'first' and 'last' represent the first index and last index of the array 'a' Perform the following steps only if(first<last).

step 1: Set i=first

step 2: Set j=last+l

step 3: Set k=first

## Bubble Sort in Java Example

by Dinesh Thakur Category: array

Algorithm for Bubble Sort:

step 2: create an integer array a[] of size num

step 3: set flag =1

step 4: initialize i=0

step 5: repeat through step-11 while (i <n) and flag=l

step 6: Reset flag=0

## Removing duplicate elements from Array in Java Example

by Dinesh Thakur Category: array

Algorithm for Removing duplicate elements from Array:

step 2: create two integer array a[],b[] of size y

step 3: initialize c=0

step 4: repeat through step-6 while c less than a.length

step 6: c=c+1

step 7: initialize c=0

## Sum and Average the elements of an array for Java Example

by Dinesh Thakur Category: array

Algorithm for Sum and Average the Elements:

step 1: set sum=0

step 3: create an integer array arr[] of size arr_size

step 4: initialize i=0

## Largest Number in an Array Java Example

by Dinesh Thakur Category: array

Algorithm for Largest Number in an Array:

step 1: set big=0,small=0

step 3: create an integer array a[] of size arr_size

step 4: initialize x=0

step 5: repeat through step-7 while x less than a.length

## Sorting an Array in Ascending Order in Java Example

by Dinesh Thakur Category: array

Algorithm for SortinganArray:

step 1: set temp=0

step 3: create an integer array a[] of size arr_size

step 4: initialize i=0

step 5: repeat through step-11 while i less than a.length

## Program to find how many 1's are present in an inputted array

by Dinesh Thakur Category: array

Algorithm for Ones Present Inputted Array:

step 1: set arr_size,j, count as three static variables of integer type

step 3: create an integer array arr[] of size arr_size

step 4: initialize i=0

## Enter a number from the keyboard and find out the Even-Odd pairs within that number.

by Dinesh Thakur Category: array

Here is the Java Example for Even-Odd pairs within that number:

## Convert Binary integer to Decimal Number Example | Java Examples

by Dinesh Thakur Category: array

Explanation of Math.pow():

Pow()method is a static method of math class present in java.lang package.

This method takes two double type argument and returns the value if the 1st argument which is raised to the power of the 2nd argument.

## Convert Decimal Integer to Binary Number Example | Java Examples

by Dinesh Thakur Category: array

Algorithm for Convert Decimal integer to Binary Number:
step 1: set i=0
step 3: create two integer arrays a[],b[] of size 20
step 4: repeat through step- 7 while num greater than 0

## Convert Decimal Integer to Octal Number Example | Java Examples

by Dinesh Thakur Category: array

Algorithm for Convert decimal integer to octal Number:

step 1: set r=0, i=0

step 2: create two integer arrays a[],b[] of size 10

## What is Array in Java? - Definition, Declare, Create, Initialize [Example]

by Dinesh Thakur Category: array

Arrays Definition: Perhaps one of the most important of all concepts that you need to learn to be effective is the array. Until now, we have looked at variables that hold just one value – the ints hold one number and the strings hold one text string. Arrays are used when we want to hold two or more values, perhaps a list. Arrays can be thought as columns in a spreadsheet – a spreadsheet can have one, or it can have many columns.

## One dimensional array - Java Examples

by Dinesh Thakur Category: array

Perhaps one of the most important of all concepts that you need to learn in order  to be effective is the array. Until now, we have looked at variables that hold just one  value – the ints hold one number and the strings hold one text string. Arrays are  used when we want to hold two or more values, perhaps a list. Arrays can be  thought as columns in a spreadsheet – a spreadsheet can have one or it can have  many columns.

Page 5 of 5

Dinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles