# Array

## Java Program for Matrix Multiplication

Here you will get java program for matrix multiplication. Suppose we have matrix A with number of rows and columns as m and n. Let B be a matrix with number of rows and columns as p and q. Their multiplication is possible only if number of columns of matrix A is equal to number …

## Java Program for Matrix Addition

Here you will get java program for matrix addition. If you have ever done addition of two matrices in your maths subject then you can easily do this in java also. It can be done in following way. Read two matrices in 2D array a[][] and b[][] respectively inside loop. Now add each element of …

## Heap Sort in Java

Here you will get program for heap sort in java. Heap sort is a sorting algorithm that uses heap data structure. Its best, worst and average time complexity is O (n log n).   How heap sort algorithm works? First we make max heap from given set of elements. In max heap each parent node …

## Bubble Sort in Java

In this tutorial you will learn about bubble sort in Java. In bubble sort algorithm each element is compared with adjacent element and are swapped if not in correct order. It is one of the simplest but worst sorting algorithm. It is suitable for sorting small list of numbers. As bubbles come up on surface …

## Difference between Array and ArrayList in Java

Here you will learn about difference between array and arraylist in java. Both array and arraylist are most important and frequently used data structure in java. Below I have discussed about various differences between them.   Difference between Array and ArrayList in Java Property Array ArrayList Size Array is fixed in size. Once declared, its …

## Binary Search in Java

In this tutorial you will learn about binary search in Java. Binary search is a searching algorithm that uses divide and conquer technique. The array on which searching is to be done must be sorted in ascending order. The target element is compared with middle element. If it is less than middle element then left half …

## Linear Search in Java

Here you will learn about linear search in Java. It is one of the simplest and basic searching algorithm which is also known as sequential search. The targeted element is compared with each element of array until it is found. Its best and worst case time complexity is O (1) and O (n) respectively. Also …